function EntityManagerWrapper::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;
}