BlockContentViewBuilder::getBuildDefaults

protected BlockContentViewBuilder::getBuildDefaults(EntityInterface $entity, $view_mode)

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 36

Class

BlockContentViewBuilder
View builder handler for custom blocks.

Namespace

Drupal\block_content

Code

1
2
3
4
5
6
7
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;
}
doc_Drupal
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.