BlockContentViewBuilder.php in Drupal 9
File
core/modules/block_content/src/BlockContentViewBuilder.php
View source
<?php
namespace Drupal\block_content;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityViewBuilder;
class BlockContentViewBuilder extends EntityViewBuilder {
public function view(EntityInterface $entity, $view_mode = 'full', $langcode = NULL) {
return $this
->viewMultiple([
$entity,
], $view_mode, $langcode)[0];
}
public function viewMultiple(array $entities = [], $view_mode = 'full', $langcode = NULL) {
$build_list = parent::viewMultiple($entities, $view_mode, $langcode);
unset($build_list['#pre_render'][0]);
return $this
->buildMultiple($build_list);
}
protected function getBuildDefaults(EntityInterface $entity, $view_mode) {
$build = parent::getBuildDefaults($entity, $view_mode);
unset($build['#theme']);
return $build;
}
}