You are here

public function EntityViewDisplay::build in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Entity/Entity/EntityViewDisplay.php \Drupal\Core\Entity\Entity\EntityViewDisplay::build()
  2. 9 core/lib/Drupal/Core/Entity/Entity/EntityViewDisplay.php \Drupal\Core\Entity\Entity\EntityViewDisplay::build()

Builds a renderable array for the components of an entity.

See the buildMultiple() method for details.

Parameters

\Drupal\Core\Entity\FieldableEntityInterface $entity: The entity being displayed.

Return value

array A renderable array for the entity.

Overrides EntityViewDisplayInterface::build

See also

\Drupal\Core\Entity\Display\EntityViewDisplayInterface::buildMultiple()

File

core/lib/Drupal/Core/Entity/Entity/EntityViewDisplay.php, line 220

Class

EntityViewDisplay
Configuration entity that contains display options for all components of a rendered entity in a given view mode.

Namespace

Drupal\Core\Entity\Entity

Code

public function build(FieldableEntityInterface $entity) {
  $build = $this
    ->buildMultiple([
    $entity,
  ]);
  return $build[0];
}