PageVariantViewBuilder.php in Page Manager 8
File
src/Entity/PageVariantViewBuilder.php
View source
<?php
namespace Drupal\page_manager\Entity;
use Drupal\Core\Cache\RefinableCacheableDependencyInterface;
use Drupal\Core\Display\ContextAwareVariantInterface;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityViewBuilderInterface;
use Drupal\Core\Field\FieldItemInterface;
use Drupal\Core\Field\FieldItemListInterface;
class PageVariantViewBuilder implements EntityViewBuilderInterface {
public function view(EntityInterface $entity, $view_mode = 'full', $langcode = NULL) {
$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();
}
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;
}
public function resetCache(array $entities = NULL) {
}
public function getCacheTags() {
}
public function buildComponents(array &$build, array $entities, array $displays, $view_mode) {
throw new \LogicException();
}
public function viewField(FieldItemListInterface $items, $display_options = array()) {
throw new \LogicException();
}
public function viewFieldItem(FieldItemInterface $item, $display_options = array()) {
throw new \LogicException();
}
}