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.

getEntityManager() deprecated

Returns the entity manager.

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 EntityManagerInterface getEntityManager() deprecated

deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use \Drupal\views\FieldAPIHandlerTrait::getEntityFieldManager() instead.

Returns the entity manager.

Return Value

EntityManagerInterface

The entity manager service.

See also

https://www.drupal.org/node/2549139

protected EntityManagerInterface getEntityFieldManager()

Returns the entity field manager.

Return Value

EntityManagerInterface

The entity field manager.