\Drupflare\Anachron\Drupal\Field LegacyFieldInstance

A Drupal 11 field config entity read the way Drupal 7 module code reads a field instance.

Drupal 7 handed out instances as arrays, so a module writes $instance['widget']['type']. The keys are mapped from the entity on each read. A key with no counterpart answers null and is listed in unmappedReads(); a write throws, because no write mapping exists until a module needs one. Widget and formatter types are Drupal 11 plugin ids, not Drupal 7 type names, and id and field_id are strings.

Summary

Methods
Properties
Constants
__construct
entity
unmappedReads
refusedWrites
resetGaps
toArray
offsetExists
offsetGet
offsetSet
offsetUnset
getIterator
count
No public properties found
KEYS
No protected methods found
No protected properties found
No protected constants found
value
widget
display
provider
recordUnmapped
refuse
caller
unmapped
refusals
entity
No private constants found

Constant

KEYS

KEYS = ['id', 'field_id', 'field_name', 'entity_type', 'bundle', 'label', 'description', 'required', 'deleted', 'settings', 'default_value', 'widget', 'display']

Properties

$unmapped

$unmapped : array

Unmapped keys read so far, as "entity_type.bundle.key by module" to a count.

Type

array<string, int> —

$refusals

$refusals : array

Writes refused so far, as "key by module" to a count.

Type

array<string, int> —

$entity

$entity : \Drupal\field\FieldConfigInterface

Type

FieldConfigInterface

Methods

__construct()

__construct(\Drupal\field\FieldConfigInterface  $entity) : mixed

Parameters

\Drupal\field\FieldConfigInterface $entity

Returns

mixed —

entity()

entity() : \Drupal\field\FieldConfigInterface

Gives the Drupal 11 entity back, for code that wants its methods.

Returns

\Drupal\field\FieldConfigInterface —

unmappedReads()

unmappedReads() : array<string,int>

Lists the unmapped keys read since the last reset.

Returns

array —

refusedWrites()

refusedWrites() : array<string,int>

Lists the writes refused since the last reset.

Returns

array —

resetGaps()

resetGaps() : void

Forgets the recorded reads and refusals.

Returns

void —

toArray()

toArray() : array<string,mixed>

Builds the whole Drupal 7 array.

Returns

array —

offsetExists()

offsetExists(mixed  $offset) : bool

Parameters

mixed $offset

Returns

bool —

offsetGet()

offsetGet(mixed  $offset) : mixed

Parameters

mixed $offset

Returns

mixed —

offsetSet()

offsetSet(mixed  $offset, mixed  $value) : void

Parameters

mixed $offset
mixed $value

Returns

void —

offsetUnset()

offsetUnset(mixed  $offset) : void

Parameters

mixed $offset

Returns

void —

getIterator()

getIterator() : \Traversable

Returns

\Traversable —

count()

count() : int

Returns

int —

value()

value(string  $key) : mixed

Parameters

string $key

Returns

mixed —

widget()

widget() : array<string,mixed>

Returns

array —

display()

display() : array<string,array<string,mixed>>

Returns

array> —

provider()

provider(string  $manager, string  $type) : ?string

Parameters

string $manager
string $type

Returns

?string —

recordUnmapped()

recordUnmapped(mixed  $key) : void

Parameters

mixed $key

Returns

void —

refuse()

refuse(string  $action, mixed  $key) : never

Parameters

string $action
mixed $key

Returns

never —

caller()

caller() : string

Names the module whose file is the nearest caller outside anachron, or the file itself.

Returns

string —