class MediaTestEmbedHooks
Hook implementations for media_test_embed.
Hierarchy
- class \Drupal\media_test_embed\Hook\MediaTestEmbedHooks
Expanded class hierarchy of MediaTestEmbedHooks
File
-
core/
modules/ media/ tests/ modules/ media_test_embed/ src/ Hook/ MediaTestEmbedHooks.php, line 16
Namespace
Drupal\media_test_embed\HookView source
class MediaTestEmbedHooks {
/**
* Implements hook_entity_view_alter().
*/
public function entityViewAlter(&$build, EntityInterface $entity, EntityViewDisplayInterface $display) {
$build['#attributes']['data-media-embed-test-active-theme'] = \Drupal::theme()->getActiveTheme()
->getName();
$build['#attributes']['data-media-embed-test-view-mode'] = $display->getMode();
}
/**
* Implements hook_entity_access().
*/
public function entityAccess(EntityInterface $entity, $operation, AccountInterface $account) {
return AccessResult::neutral()->addCacheTags([
'_media_test_embed_filter_access:' . $entity->getEntityTypeId() . ':' . $entity->id(),
]);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.