EntityViewsData
class EntityViewsData implements EntityHandlerInterface, EntityViewsDataInterface (View source)
Provides generic views integration for entities.
Traits
Wrapper methods for \Drupal\Core\StringTranslation\TranslationInterface.
Provides a standard way to announce deprecated properties.
Properties
| protected TranslationInterface | $stringTranslation | The string translation service. |
from StringTranslationTrait |
| protected | $deprecatedProperties | {@inheritdoc} | |
| protected EntityTypeInterface | $entityType | Entity type for this views data handler instance. |
|
| protected SqlEntityStorageInterface | $storage | The storage used for this entity type. |
|
| protected ModuleHandlerInterface | $moduleHandler | The module handler. |
|
| protected TranslationInterface | $translationManager | The translation manager. |
|
| protected FieldStorageDefinitionInterface[] | $fieldStorageDefinitions | The field storage definitions for all base fields of the entity type. |
|
| protected EntityTypeManagerInterface | $entityTypeManager | The entity type manager. |
|
| protected EntityFieldManagerInterface | $entityFieldManager | The entity field manager. |
Methods
Translates a string to the current language or to a given language.
Formats a string containing a count of items.
Returns the number of plurals supported by a given language.
Gets the string translation service.
Constructs an EntityViewsData object.
Instantiates a new instance of this entity handler.
Gets the field storage definitions.
Returns views data for the entity type.
Sets the entity links in case corresponding link templates exist.
Puts the views data for a single field onto the views data.
Provides the views data for a given data type and schema field.
Processes the views data for a language field.
Processes the views data for an entity reference field.
Processes the views data for a text field with formatting.
Processes the views data for a UUID field.
Gets the table of an entity type to be used as base table in views.
Details
protected TranslatableMarkup
t(string $string, array $args = [], array $options = [])
Translates a string to the current language or to a given language.
See \Drupal\Core\StringTranslation\TranslatableMarkup::__construct() for important security information and usage guidelines.
In order for strings to be localized, make them available in one of the ways supported by the
protected
formatPlural($count, $singular, $plural, array $args = [], array $options = [])
Formats a string containing a count of items.
protected
getNumberOfPlurals($langcode = NULL)
Returns the number of plurals supported by a given language.
protected TranslationInterface
getStringTranslation()
Gets the string translation service.
$this
setStringTranslation(TranslationInterface $translation)
Sets the string translation service to use.
__get($name)
Allows to access deprecated/removed properties.
This method must be public.
__construct(EntityTypeInterface $entity_type, SqlEntityStorageInterface $storage_controller, EntityTypeManagerInterface $entity_type_manager, ModuleHandlerInterface $module_handler, TranslationInterface $translation_manager, EntityFieldManagerInterface $entity_field_manager = NULL)
Constructs an EntityViewsData object.
static EntityHandlerInterface
createInstance(ContainerInterface $container, EntityTypeInterface $entity_type)
Instantiates a new instance of this entity handler.
This is a factory method that returns a new instance of this object. The factory should pass any needed dependencies into the constructor of this object, but not the container itself. Every call to this method must return a new instance of this object; that is, it may not implement a singleton.
protected FieldStorageDefinitionInterface[]
getFieldStorageDefinitions()
Gets the field storage definitions.
array
getViewsData()
Returns views data for the entity type.
protected
addEntityLinks(array $data)
Sets the entity links in case corresponding link templates exist.
protected
mapFieldDefinition(string $table, string $field_name, FieldDefinitionInterface $field_definition, TableMappingInterface $table_mapping, array $table_data)
Puts the views data for a single field onto the views data.
protected array
mapSingleFieldViewsData(string $table, string $field_name, string $field_type, string $column_name, string $column_type, bool $first, FieldDefinitionInterface $field_definition)
Provides the views data for a given data type and schema field.
protected
processViewsDataForLanguage(string $table, FieldDefinitionInterface $field_definition, array $views_field, string $field_column_name)
Processes the views data for a language field.
protected
processViewsDataForEntityReference(string $table, FieldDefinitionInterface $field_definition, array $views_field, string $field_column_name)
Processes the views data for an entity reference field.
protected
processViewsDataForTextLong(string $table, FieldDefinitionInterface $field_definition, array $views_field, string $field_column_name)
Processes the views data for a text field with formatting.
protected
processViewsDataForUuid(string $table, FieldDefinitionInterface $field_definition, array $views_field, string $field_column_name)
Processes the views data for a UUID field.
string
getViewsTableForEntityType(EntityTypeInterface $entity_type)
Gets the table of an entity type to be used as base table in views.