Drupal 8  8.0.2
EntityViewsData Class Reference
Inheritance diagram for EntityViewsData:

Public Member Functions

 __construct (EntityTypeInterface $entity_type, SqlEntityStorageInterface $storage_controller, EntityManagerInterface $entity_manager, ModuleHandlerInterface $module_handler, TranslationInterface $translation_manager)
 
 getViewsData ()
 
 getViewsTableForEntityType (EntityTypeInterface $entity_type)
 

Static Public Member Functions

static createInstance (ContainerInterface $container, EntityTypeInterface $entity_type)
 

Protected Member Functions

 getFieldStorageDefinitions ()
 
 addEntityLinks (array &$data)
 
 mapFieldDefinition ($table, $field_name, FieldDefinitionInterface $field_definition, TableMappingInterface $table_mapping, &$table_data)
 
 mapSingleFieldViewsData ($table, $field_name, $field_type, $column_name, $column_type, $first, FieldDefinitionInterface $field_definition)
 
 processViewsDataForLanguage ($table, FieldDefinitionInterface $field_definition, array &$views_field, $field_column_name)
 
 processViewsDataForEntityReference ($table, FieldDefinitionInterface $field_definition, array &$views_field, $field_column_name)
 
 processViewsDataForTextLong ($table, FieldDefinitionInterface $field_definition, array &$views_field, $field_column_name)
 
 processViewsDataForUuid ($table, FieldDefinitionInterface $field_definition, array &$views_field, $field_column_name)
 

Protected Attributes

 $entityType
 
 $storage
 
 $moduleHandler
 
 $translationManager
 
 $fieldStorageDefinitions
 

Detailed Description

Provides generic views integration for entities.

Constructor & Destructor Documentation

__construct ( EntityTypeInterface  $entity_type,
SqlEntityStorageInterface  $storage_controller,
EntityManagerInterface  $entity_manager,
ModuleHandlerInterface  $module_handler,
TranslationInterface  $translation_manager 
)

Constructs an EntityViewsData object.

Parameters
\Drupal\Core\Entity\EntityTypeInterface$entity_typeThe entity type to provide views integration for.
\Drupal\Core\Entity\Sql\SqlEntityStorageInterface$storage_controllerThe storage controller used for this entity type.
\Drupal\Core\Entity\EntityManagerInterface$entity_managerThe entity manager.
\Drupal\Core\Extension\ModuleHandlerInterface$module_handlerThe module handler.
\Drupal\Core\StringTranslation\TranslationInterface$translation_managerThe translation manager.

References Drupal\entityManager(), and Drupal\moduleHandler().

Here is the call graph for this function:

Member Function Documentation

addEntityLinks ( array &  $data)
protected

Sets the entity links in case corresponding link templates exist.

Parameters
array$dataThe views data of the base table.

References t().

Referenced by EntityViewsData\getViewsData().

Here is the call graph for this function:

Here is the caller graph for this function:

static createInstance ( ContainerInterface  $container,
EntityTypeInterface  $entity_type 
)
static

{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.

Parameters
\Symfony\Component\DependencyInjection\ContainerInterface$containerThe service container this object should use.
\Drupal\Core\Entity\EntityTypeInterface$entity_typeThe entity type definition.
Returns
static A new instance of the entity handler.
}

Implements EntityHandlerInterface.

References EntityTypeInterface\get(), and EntityTypeInterface\id().

Here is the call graph for this function:

getFieldStorageDefinitions ( )
protected

Gets the field storage definitions.

Returns
[]

References Drupal\entityManager().

Referenced by EntityViewsData\mapFieldDefinition().

Here is the call graph for this function:

Here is the caller graph for this function:

getViewsData ( )

{Returns views data for the entity type.

Returns
array Views data in the format of hook_views_data().
}

Implements EntityViewsDataInterface.

References EntityViewsData\addEntityLinks(), Drupal\entityManager(), EntityViewsData\mapFieldDefinition(), and t().

Here is the call graph for this function:

getViewsTableForEntityType ( EntityTypeInterface  $entity_type)

{Gets the table of an entity type to be used as base table in views.

Parameters
\Drupal\Core\Entity\EntityTypeInterface$entity_typeThe entity type.
Returns
string The name of the base table in views.
}

Implements EntityViewsDataInterface.

References EntityTypeInterface\getBaseTable(), and EntityTypeInterface\getDataTable().

Referenced by EntityViewsData\processViewsDataForEntityReference().

Here is the call graph for this function:

Here is the caller graph for this function:

mapFieldDefinition (   $table,
  $field_name,
FieldDefinitionInterface  $field_definition,
TableMappingInterface  $table_mapping,
$table_data 
)
protected

Puts the views data for a single field onto the views data.

Parameters
string$tableThe table of the field to handle.
string$field_nameThe name of the field to handle.
\Drupal\Core\Field\FieldDefinitionInterface$field_definitionThe field definition defined in Entity::baseFieldDefinitions()
\Drupal\Core\Entity\Sql\TableMappingInterface$table_mappingThe table mapping information
array$table_dataA reference to a specific entity table (for example data_table) inside the views data.

References TableMappingInterface\getColumnNames(), EntityViewsData\getFieldStorageDefinitions(), FieldDefinitionInterface\getType(), and EntityViewsData\mapSingleFieldViewsData().

Referenced by EntityViewsData\getViewsData().

Here is the call graph for this function:

Here is the caller graph for this function:

mapSingleFieldViewsData (   $table,
  $field_name,
  $field_type,
  $column_name,
  $column_type,
  $first,
FieldDefinitionInterface  $field_definition 
)
protected

Provides the views data for a given data type and schema field.

Parameters
string$tableThe table of the field to handle.
string$field_nameThe machine name of the field being processed.
string$field_typeThe type of field being handled.
string$column_nameFor fields containing multiple columns, the column name being processed.
string$column_typeWithin the field, the column type being handled.
bool$firstTRUE if this is the first column within the field.
\Drupal\Core\Field\FieldDefinitionInterface$field_definitionThe field definition.
Returns
array The modified views data field definition.

References DataDefinitionInterface\getDescription(), and DataDefinitionInterface\getLabel().

Referenced by EntityViewsData\mapFieldDefinition().

Here is the call graph for this function:

Here is the caller graph for this function:

processViewsDataForEntityReference (   $table,
FieldDefinitionInterface  $field_definition,
array &  $views_field,
  $field_column_name 
)
protected

Processes the views data for an entity reference field.

Parameters
string$tableThe table the language field is added to.
\Drupal\Core\Field\FieldDefinitionInterface$field_definitionThe field definition.
array$views_fieldThe views field data.
string$field_column_nameThe field column being processed.

References Drupal\entityManager(), ListDataDefinitionInterface\getItemDefinition(), FieldDefinitionInterface\getName(), and EntityViewsData\getViewsTableForEntityType().

Here is the call graph for this function:

processViewsDataForLanguage (   $table,
FieldDefinitionInterface  $field_definition,
array &  $views_field,
  $field_column_name 
)
protected

Processes the views data for a language field.

Parameters
string$tableThe table the language field is added to.
\Drupal\Core\Field\FieldDefinitionInterface$field_definitionThe field definition.
array$views_fieldThe views field data.
string$field_column_nameThe field column being processed.

References FieldDefinitionInterface\getName(), and t().

Here is the call graph for this function:

processViewsDataForTextLong (   $table,
FieldDefinitionInterface  $field_definition,
array &  $views_field,
  $field_column_name 
)
protected

Processes the views data for a text field with formatting.

Parameters
string$tableThe table the field is added to.
\Drupal\Core\Field\FieldDefinitionInterface$field_definitionThe field definition.
array$views_fieldThe views field data.
string$field_column_nameThe field column being processed.

References FieldDefinitionInterface\getName().

Here is the call graph for this function:

processViewsDataForUuid (   $table,
FieldDefinitionInterface  $field_definition,
array &  $views_field,
  $field_column_name 
)
protected

Processes the views data for a UUID field.

Parameters
string$tableThe table the field is added to.
\Drupal\Core\Field\FieldDefinitionInterface$field_definitionThe field definition.
array$views_fieldThe views field data.
string$field_column_nameThe field column being processed.

The documentation for this class was generated from the following file: