function entity_test_entity_display_build_alter

Same name in other branches
  1. 9 core/modules/system/tests/modules/entity_test/entity_test.module \entity_test_entity_display_build_alter()
  2. 10 core/modules/system/tests/modules/entity_test/entity_test.module \entity_test_entity_display_build_alter()
  3. 11.x core/modules/system/tests/modules/entity_test/entity_test.module \entity_test_entity_display_build_alter()

Implements hook_entity_display_build_alter().

File

core/modules/system/tests/modules/entity_test/entity_test.module, line 805

Code

function entity_test_entity_display_build_alter(&$build, $context) {
    
    /** @var \Drupal\Core\Entity\ContentEntityInterface $entity */
    $entity = $context['entity'];
    if ($entity->getEntityTypeId() == 'entity_test' && $entity->bundle() == 'display_build_alter_bundle') {
        $build['entity_display_build_alter']['#markup'] = 'Content added in hook_entity_display_build_alter for entity id ' . $entity->id();
    }
}

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