EntityViewBuilderInterface
interface EntityViewBuilderInterface (View source)
Defines an interface for entity view builders.
Methods
Builds the component fields and properties of a set of entities.
Builds the render array for the provided entity.
Builds the render array for the provided entities.
Resets the entity render cache.
Builds a renderable array for the value of a single field in an entity.
Builds a renderable array for a single field item.
The cache tag associated with this entity view builder.
Details
buildComponents(array $build, array $entities, array $displays, string $view_mode)
Builds the component fields and properties of a set of entities.
array
view(EntityInterface $entity, string $view_mode = 'full', string $langcode = NULL)
Builds the render array for the provided entity.
A
viewMultiple(array $entities = [], string $view_mode = 'full', string $langcode = NULL)
Builds the render array for the provided entities.
resetCache(array $entities = NULL)
Resets the entity render cache.
array
viewField(FieldItemListInterface $items, string|array $display_options = [])
Builds a renderable array for the value of a single field in an entity.
The resulting output is a fully themed field with label and multiple values.
This function can be used by third-party modules that need to output an isolated field.
- Do not use inside node (or any other entity) templates; use render($content[FIELD_NAME]) instead.
- The FieldItemInterface::view() method can be used to output a single formatted field value, without label or wrapping field markup.
The function takes care of invoking the prepare_view steps. It also respects field access permissions.
array
viewFieldItem(FieldItemInterface $item, string|array $display_options = [])
Builds a renderable array for a single field item.
array
getCacheTags()
The cache tag associated with this entity view builder.
An entity view builder is instantiated on a per-entity type basis, so the cache tags are also per-entity type.