You are here

public function EntityManagerWrapper::getViewBuilder in Devel 8

Same name and namespace in other branches
  1. 8.3 webprofiler/src/Entity/EntityManagerWrapper.php \Drupal\webprofiler\Entity\EntityManagerWrapper::getViewBuilder()
  2. 8.2 webprofiler/src/Entity/EntityManagerWrapper.php \Drupal\webprofiler\Entity\EntityManagerWrapper::getViewBuilder()
  3. 4.x webprofiler/src/Entity/EntityManagerWrapper.php \Drupal\webprofiler\Entity\EntityManagerWrapper::getViewBuilder()

Creates a new view builder instance.

Parameters

string $entity_type_id: The entity type ID for this view builder.

Return value

\Drupal\Core\Entity\EntityViewBuilderInterface A view builder instance.

Overrides EntityTypeManagerInterface::getViewBuilder

File

webprofiler/src/Entity/EntityManagerWrapper.php, line 67

Class

EntityManagerWrapper
Class EntityManagerWrapper

Namespace

Drupal\webprofiler\Entity

Code

public function getViewBuilder($entity_type) {

  /** @var EntityViewBuilderInterface $handler */
  $handler = $this
    ->getHandler($entity_type, 'view_builder');
  if ($handler instanceof EntityViewBuilderInterface) {
    if (!isset($this->rendered[$entity_type])) {
      $handler = new EntityViewBuilderDecorator($handler);
      $this->rendered[$entity_type] = $handler;
    }
    else {
      $handler = $this->rendered[$entity_type];
    }
  }
  return $handler;
}