class PageVariantViewBuilder in Page Manager 8
Same name and namespace in other branches
- 8.4 src/Entity/PageVariantViewBuilder.php \Drupal\page_manager\Entity\PageVariantViewBuilder
Provides a view builder for page variant entities.
Hierarchy
- class \Drupal\page_manager\Entity\PageVariantViewBuilder implements EntityViewBuilderInterface
Expanded class hierarchy of PageVariantViewBuilder
File
- src/
Entity/ PageVariantViewBuilder.php, line 20 - Contains \Drupal\page_manager\Entity\PageVariantViewBuilder.
Namespace
Drupal\page_manager\EntityView source
class PageVariantViewBuilder implements EntityViewBuilderInterface {
/**
* {@inheritdoc}
*/
public function view(EntityInterface $entity, $view_mode = 'full', $langcode = NULL) {
/** @var \Drupal\page_manager\PageVariantInterface $entity */
$variant_plugin = $entity
->getVariantPlugin();
if ($variant_plugin instanceof ContextAwareVariantInterface) {
$variant_plugin
->setContexts($entity
->getContexts());
}
if ($variant_plugin instanceof RefinableCacheableDependencyInterface) {
$variant_plugin
->addCacheableDependency($entity);
}
return $variant_plugin
->build();
}
/**
* {@inheritdoc}
*/
public function viewMultiple(array $entities = [], $view_mode = 'full', $langcode = NULL) {
$build = [];
foreach ($entities as $key => $entity) {
$build[$key] = $this
->view($entity, $view_mode, $langcode);
}
return $build;
}
/**
* {@inheritdoc}
*/
public function resetCache(array $entities = NULL) {
// Intentionally empty.
}
/**
* {@inheritdoc}
*/
public function getCacheTags() {
// Intentionally empty.
}
/**
* {@inheritdoc}
*/
public function buildComponents(array &$build, array $entities, array $displays, $view_mode) {
throw new \LogicException();
}
/**
* {@inheritdoc}
*/
public function viewField(FieldItemListInterface $items, $display_options = array()) {
throw new \LogicException();
}
/**
* {@inheritdoc}
*/
public function viewFieldItem(FieldItemInterface $item, $display_options = array()) {
throw new \LogicException();
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
PageVariantViewBuilder:: |
public | function |
Builds the component fields and properties of a set of entities. Overrides EntityViewBuilderInterface:: |
|
PageVariantViewBuilder:: |
public | function |
The cache tag associated with this entity view builder. Overrides EntityViewBuilderInterface:: |
|
PageVariantViewBuilder:: |
public | function |
Resets the entity render cache. Overrides EntityViewBuilderInterface:: |
|
PageVariantViewBuilder:: |
public | function |
Builds the render array for the provided entity. Overrides EntityViewBuilderInterface:: |
|
PageVariantViewBuilder:: |
public | function |
Builds a renderable array for the value of a single field in an entity. Overrides EntityViewBuilderInterface:: |
|
PageVariantViewBuilder:: |
public | function |
Builds a renderable array for a single field item. Overrides EntityViewBuilderInterface:: |
|
PageVariantViewBuilder:: |
public | function |
Builds the render array for the provided entities. Overrides EntityViewBuilderInterface:: |