field_create_field()
field_create_field(array{field_name: string, type: string} $field) : \Drupal\field\FieldStorageConfigInterface
Parameters
| array{field_name: string, type: string} | $field |
anachron_field_storage_for(string $entity_type, string $field_name) : void
Copies a field's storage to another entity type.
A Drupal 7 field belongs to no entity type and any instance may use it. A Drupal 11 storage is
per entity type, and field_create_field() makes it for node. When the instance names another
type, its storage is the node one made again for that type.
| string | $entity_type | |
| string | $field_name |
field_info_fields() : array<string,array<string,mixed>>
Lists every field the way Drupal 7 did, as arrays keyed by field name.
A name used on several entity types lists the bundles of each under its entity type. The keys
are the ones a Drupal 7 module reads: id, field_name, deleted (always false), type, module, settings, cardinality,
translatable, locked, indexes, columns and bundles. A call made from inside this
function's own load answers an empty list, for the reason field_info_instances() gives.
field_read_instances(array$params = [], array $include_additional = []) : list<\Drupflare\Anachron\Drupal\Field\LegacyFieldInstance>
Reads field instances matching Drupal 7 conditions, as a flat list.
Only entity_type, bundle, field_name and deleted are conditions here. Drupal 11 keeps no
deleted instances to read, so deleted true answers an empty list. Another key is refused and
recorded, and the read answers an empty list rather than every instance.
| array |
$params | |
| array | $include_additional |
field_info_instances(?string $entity_type = null, ?string $bundle_name = null) : array
Lists field instances the way Drupal 7 grouped them, each one an array-like `LegacyFieldInstance`.
Drupal 11 calls hook_entity_load for config entities too, and a Drupal 7 implementation often
reads the instances from there, which loads the instances again without end. A call made from
inside this function's own load answers an empty list.
| ?string | $entity_type | |
| ?string | $bundle_name |
Keyed by entity type, bundle and field name, with the levels you named left out.