You are here

function layout_builder_test_node_view in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/layout_builder/tests/modules/layout_builder_test/layout_builder_test.module \layout_builder_test_node_view()
  2. 9 core/modules/layout_builder/tests/modules/layout_builder_test/layout_builder_test.module \layout_builder_test_node_view()

Implements hook_entity_node_view().

File

core/modules/layout_builder/tests/modules/layout_builder_test/layout_builder_test.module, line 66
Provides hook implementations for Layout Builder tests.

Code

function layout_builder_test_node_view(array &$build, EntityInterface $entity, EntityViewDisplayInterface $display, $view_mode) {
  if ($display
    ->getComponent('layout_builder_test')) {
    $build['layout_builder_test'] = [
      '#markup' => 'Extra, Extra read all about it.',
    ];
  }
  if ($display
    ->getComponent('layout_builder_test_2')) {
    $build['layout_builder_test_2'] = [
      '#markup' => 'Extra Field 2 is hidden by default.',
    ];
  }
}