Drupal 8  8.0.2
EntityFieldRenderer Class Reference
Inheritance diagram for EntityFieldRenderer:

Public Member Functions

 __construct (ViewExecutable $view, $relationship, LanguageManagerInterface $language_manager, EntityTypeInterface $entity_type, EntityManagerInterface $entity_manager)
 getCacheContexts ()
 getEntityTypeId ()
 query (QueryPluginBase $query, $relationship=NULL)
 render (ResultRow $row, Field $field=NULL)
- Public Member Functions inherited from RendererBase
 __construct (ViewExecutable $view, LanguageManagerInterface $language_manager, EntityTypeInterface $entity_type)
 getCacheMaxAge ()
 getCacheContexts ()
 getCacheTags ()
 query (QueryPluginBase $query, $relationship=NULL)
 preRender (array $result)
 render (ResultRow $row)

Protected Member Functions

 getEntityManager ()
 getLanguageManager ()
 getView ()
 buildFields (array $values)
 getRenderableFieldIds ()

Protected Attributes

 $processedRows = []
- Protected Attributes inherited from RendererBase

Additional Inherited Members

- Data Fields inherited from RendererBase

Detailed Description

Renders entity fields.

This is used to build render arrays for all entity field values of a view result set sharing the same relationship. An entity translation renderer is used internally to handle entity language properly.

Constructor & Destructor Documentation

__construct ( ViewExecutable  $view,
LanguageManagerInterface  $language_manager,
EntityTypeInterface  $entity_type,
EntityManagerInterface  $entity_manager 

Constructs an EntityFieldRenderer object.

\Drupal\views\ViewExecutable$viewThe view whose fields are being rendered.
string$relationshipThe relationship to be handled.
\Drupal\Core\Language\LanguageManagerInterface$language_managerThe language manager.
\Drupal\Core\Entity\EntityTypeInterface$entity_typeThe entity type.
\Drupal\Core\Entity\EntityManagerInterface$entity_managerThe entity manager.

References Drupal\entityManager().

Here is the call graph for this function:

Member Function Documentation

buildFields ( array  $values)

Builds the render arrays for all fields of all result rows.

The output is built using EntityViewDisplay objects to leverage multiple-entity building and ensure a common code path with regular entity view.

  • Each relationship is handled by a separate EntityFieldRenderer instance, since it operates on its own set of entities. This also ensures different entity types are handled separately, as they imply different relationships.
  • Within each relationship, the fields to render are arranged in unique sets containing each field at most once (an EntityViewDisplay can only process a field once with given display options, but a View can contain the same field several times with different display options).
  • For each set of fields, entities are processed by bundle, so that formatters can operate on the proper field definition for the bundle.
\Drupal\views\ResultRow[]$values An array of all ResultRow objects returned from the query.
array A renderable array for the fields handled by this renderer.
See Also

References Entity\create(), EntityFieldRenderer\getEntityTypeId(), and EntityFieldRenderer\getRenderableFieldIds().

Referenced by EntityFieldRenderer\render().

Here is the call graph for this function:

Here is the caller graph for this function:

getCacheContexts ( )

{The cache contexts associated with this object.These identify a specific variation/representation of the object.Cache contexts are tokens: placeholders that are converted to cache keys by the service. The replacement value depends on the request context (the current URL, language, and so on). They're converted before storing an object in cache.

string[] An array of cache context tokens, used to generate a cache ID.
See Also

Implements CacheableDependencyInterface.

getEntityManager ( )


getEntityTypeId ( )


Referenced by EntityFieldRenderer\buildFields().

Here is the caller graph for this function:

getLanguageManager ( )


getRenderableFieldIds ( )

Returns a list of names of entity fields to be rendered.

string[] An associative array of views fields.

Referenced by EntityFieldRenderer\buildFields().

Here is the caller graph for this function:

getView ( )


query ( QueryPluginBase  $query,
  $relationship = NULL 


render ( ResultRow  $row,
Field  $field = NULL 

Renders entity field data.

\Drupal\views\ResultRow$rowA single row of the query result.
\Drupal\views\Plugin\views\field\Field$field(optional) A field to be rendered.
array A renderable array for the entity data contained in the result row.

References EntityFieldRenderer\buildFields().

Here is the call graph for this function:

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