class ContextualTestHooks
Hook implementations for contextual_test.
Hierarchy
- class \Drupal\contextual_test\Hook\ContextualTestHooks
Expanded class hierarchy of ContextualTestHooks
File
-
core/
modules/ contextual/ tests/ modules/ contextual_test/ src/ Hook/ ContextualTestHooks.php, line 13
Namespace
Drupal\contextual_test\HookView source
class ContextualTestHooks {
/**
* Implements hook_block_view_alter().
*/
public function blockViewAlter(array &$build, BlockPluginInterface $block) {
$build['#contextual_links']['contextual_test'] = [
'route_parameters' => [],
];
}
/**
* Implements hook_contextual_links_view_alter().
*
* @todo Apparently this too late to attach the library?
* It won't work without contextual_test_page_attachments_alter()
* Is that a problem? Should the contextual module itself do the attaching?
*/
public function contextualLinksViewAlter(&$element, $items) {
if (isset($element['#links']['contextual-test-ajax'])) {
$element['#attached']['library'][] = 'core/drupal.dialog.ajax';
}
}
/**
* Implements hook_page_attachments_alter().
*/
public function pageAttachmentsAlter(array &$attachments) {
$attachments['#attached']['library'][] = 'core/drupal.dialog.ajax';
}
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
ContextualTestHooks::blockViewAlter | public | function | Implements hook_block_view_alter(). |
ContextualTestHooks::contextualLinksViewAlter | public | function | Implements hook_contextual_links_view_alter(). |
ContextualTestHooks::pageAttachmentsAlter | public | function | Implements hook_page_attachments_alter(). |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.