You are here

protected function BlockContentViewBuilder::getBuildDefaults in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/block_content/src/BlockContentViewBuilder.php \Drupal\block_content\BlockContentViewBuilder::getBuildDefaults()
  2. 9 core/modules/block_content/src/BlockContentViewBuilder.php \Drupal\block_content\BlockContentViewBuilder::getBuildDefaults()

Provides entity-specific defaults to the build process.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity for which the defaults should be provided.

string $view_mode: The view mode that should be used.

Return value

array

Overrides EntityViewBuilder::getBuildDefaults

File

core/modules/block_content/src/BlockContentViewBuilder.php, line 42

Class

BlockContentViewBuilder
View builder handler for custom blocks.

Namespace

Drupal\block_content

Code

protected function getBuildDefaults(EntityInterface $entity, $view_mode) {
  $build = parent::getBuildDefaults($entity, $view_mode);

  // The custom block will be rendered in the wrapped block template already
  // and thus has no entity template itself.
  unset($build['#theme']);
  return $build;
}