trait FieldAPIHandlerTrait (View source)

A trait containing helper methods for field definitions.

Properties

protected FieldDefinitionInterface $fieldDefinition

The field definition.

protected FieldStorageConfigInterface $fieldStorageDefinition

The field storage definition.

protected EntityFieldManagerInterface $entityFieldManager

The entity field manager.

Methods

getFieldDefinition()

Gets the field definition.

getFieldStorageDefinition()

Gets the field storage configuration.

getEntityFieldManager()

Returns the entity field manager.

Details

protected FieldDefinitionInterface getFieldDefinition()

Gets the field definition.

A View works on an entity type across bundles, and thus only has access to field storage definitions. In order to be able to use widgets and formatters, we create a generic field definition out of that storage definition.

Return Value

FieldDefinitionInterface

The field definition used by this handler.

See also

BaseFieldDefinition::createFromFieldStorageDefinition

protected FieldStorageConfigInterface getFieldStorageDefinition()

Gets the field storage configuration.

Return Value

FieldStorageConfigInterface

The field storage definition used by this handler

protected EntityFieldManagerInterface getEntityFieldManager()

Returns the entity field manager.

Return Value

EntityFieldManagerInterface

The entity field manager.