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) : void {
$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(),
]);
}
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
MediaTestEmbedHooks::entityAccess | public | function | Implements hook_entity_access(). |
MediaTestEmbedHooks::entityViewAlter | public | function | Implements hook_entity_view_alter(). |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.