You are here

class EntityViewBuilderDecorator in Devel 8.3

Same name and namespace in other branches
  1. 8 webprofiler/src/Entity/EntityViewBuilderDecorator.php \Drupal\webprofiler\Entity\EntityViewBuilderDecorator
  2. 8.2 webprofiler/src/Entity/EntityViewBuilderDecorator.php \Drupal\webprofiler\Entity\EntityViewBuilderDecorator
  3. 4.x webprofiler/src/Entity/EntityViewBuilderDecorator.php \Drupal\webprofiler\Entity\EntityViewBuilderDecorator

Class EntityViewBuilderDecorator.

Hierarchy

Expanded class hierarchy of EntityViewBuilderDecorator

File

webprofiler/src/Entity/EntityViewBuilderDecorator.php, line 16

Namespace

Drupal\webprofiler\Entity
View source
class EntityViewBuilderDecorator extends EntityDecorator implements EntityHandlerInterface, EntityViewBuilderInterface {

  /**
   * @param \Drupal\Core\Entity\EntityViewBuilderInterface $controller
   */
  public function __construct(EntityViewBuilderInterface $controller) {
    parent::__construct($controller);
    $this->entities = [];
  }

  /**
   * {@inheritdoc}
   */
  public function buildComponents(array &$build, array $entities, array $displays, $view_mode, $langcode = NULL) {
    $this
      ->getOriginalObject()
      ->buildComponents($build, $entities, $displays, $view_mode, $langcode);
  }

  /**
   * {@inheritdoc}
   */
  public function view(EntityInterface $entity, $view_mode = 'full', $langcode = NULL) {
    $this->entities[] = $entity;
    return $this
      ->getOriginalObject()
      ->view($entity, $view_mode, $langcode);
  }

  /**
   * {@inheritdoc}
   */
  public function viewMultiple(array $entities = [], $view_mode = 'full', $langcode = NULL) {
    $this->entities = array_merge($this->entities, $entities);
    return $this
      ->getOriginalObject()
      ->viewMultiple($entities, $view_mode, $langcode);
  }

  /**
   * {@inheritdoc}
   */
  public function resetCache(array $entities = NULL) {
    $this
      ->getOriginalObject()
      ->resetCache($entities);
  }

  /**
   * {@inheritdoc}
   */
  public function viewField(FieldItemListInterface $items, $display_options = []) {
    return $this
      ->getOriginalObject()
      ->viewField($items, $display_options);
  }

  /**
   * {@inheritdoc}
   */
  public function viewFieldItem(FieldItemInterface $item, $display_options = []) {
    return $this
      ->getOriginalObject()
      ->viewFieldItem($item, $display_options);
  }

  /**
   * {@inheritdoc}
   */
  public function getCacheTags() {
    return $this
      ->getOriginalObject()
      ->getCacheTags();
  }

  /**
   * {@inheritdoc}
   */
  public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) {
    return new static($entity_type, $container
      ->get('entity_type.manager'), $container
      ->get('language_manager'));
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Decorator::$object protected property @var
Decorator::getOriginalObject public function Return the original (i.e. non decorated) object.
Decorator::isCallable public function Returns true if $method is a PHP callable.
Decorator::__call public function
Decorator::__get public function
EntityDecorator::$entities protected property
EntityDecorator::getEntities public function
EntityViewBuilderDecorator::buildComponents public function Builds the component fields and properties of a set of entities. Overrides EntityViewBuilderInterface::buildComponents
EntityViewBuilderDecorator::createInstance public static function Instantiates a new instance of this entity handler. Overrides EntityHandlerInterface::createInstance
EntityViewBuilderDecorator::getCacheTags public function The cache tag associated with this entity view builder. Overrides EntityViewBuilderInterface::getCacheTags
EntityViewBuilderDecorator::resetCache public function Resets the entity render cache. Overrides EntityViewBuilderInterface::resetCache
EntityViewBuilderDecorator::view public function Builds the render array for the provided entity. Overrides EntityViewBuilderInterface::view
EntityViewBuilderDecorator::viewField public function Builds a renderable array for the value of a single field in an entity. Overrides EntityViewBuilderInterface::viewField
EntityViewBuilderDecorator::viewFieldItem public function Builds a renderable array for a single field item. Overrides EntityViewBuilderInterface::viewFieldItem
EntityViewBuilderDecorator::viewMultiple public function Builds the render array for the provided entities. Overrides EntityViewBuilderInterface::viewMultiple
EntityViewBuilderDecorator::__construct public function Overrides Decorator::__construct