function MediaTestEmbedHooks::entityViewAlter
Implements hook_entity_view_alter().
File
-
core/
modules/ media/ tests/ modules/ media_test_embed/ src/ Hook/ MediaTestEmbedHooks.php, line 21
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.