function MediaTestEmbedHooks::entityViewAlter
Same name and namespace in other branches
- 11.x core/modules/media/tests/modules/media_test_embed/src/Hook/MediaTestEmbedHooks.php \Drupal\media_test_embed\Hook\MediaTestEmbedHooks::entityViewAlter()
Implements hook_entity_view_alter().
Attributes
#[Hook('entity_view_alter')]
File
-
core/
modules/ media/ tests/ modules/ media_test_embed/ src/ Hook/ MediaTestEmbedHooks.php, line 22
Class
- MediaTestEmbedHooks
- Hook implementations for media_test_embed.
Namespace
Drupal\media_test_embed\HookCode
public function entityViewAlter(&$build, EntityInterface $entity, EntityViewDisplayInterface $display) : void {
$build['#attributes']['data-media-embed-test-active-theme'] = \Drupal::theme()->getActiveTheme()
->getName();
$build['#attributes']['data-media-embed-test-view-mode'] = $display->getMode();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.