function FieldLayoutHooks::entityViewAlter

Implements hook_entity_view_alter().

Attributes

#[Hook('entity_view_alter')]

File

core/modules/field_layout/src/Hook/FieldLayoutHooks.php, line 61

Class

FieldLayoutHooks
Hook implementations for field_layout.

Namespace

Drupal\field_layout\Hook

Code

public function entityViewAlter(array &$build, EntityInterface $entity, EntityViewDisplayInterface $display) : void {
  if ($display instanceof EntityDisplayWithLayoutInterface) {
    \Drupal::classResolver(FieldLayoutBuilder::class)->buildView($build, $display);
  }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.