function EntityTestHooks::entityDisplayBuildAlter

Implements hook_entity_display_build_alter().

File

core/modules/system/tests/modules/entity_test/src/Hook/EntityTestHooks.php, line 600

Class

EntityTestHooks
Hook implementations for entity_test.

Namespace

Drupal\entity_test\Hook

Code

public function entityDisplayBuildAlter(&$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.