function hook_contextual_links_view_alter
Alter a contextual links element before it is rendered.
This hook is invoked by contextual_pre_render_links(). The renderable array of #type 'contextual_links', containing the entire contextual links data that is passed in by reference. Further links may be added or existing links can be altered.
Parameters
$element: A renderable array representing the contextual links.
$items: An associative array containing the original contextual link items, as generated by menu_contextual_links(), which were used to build $element['#links'].
See also
hook_menu_contextual_links_alter()
Related topics
4 functions implement hook_contextual_links_view_alter()
Note: the procedural functions in this list are found by pattern matching, so the list may include some functions that are not actually implementations of this hook.
- ContextualHooks::contextualLinksViewAlter in core/modules/ contextual/ src/ Hook/ ContextualHooks.php 
- Implements hook_contextual_links_view_alter().
- ContextualTestHooks::contextualLinksViewAlter in core/modules/ contextual/ tests/ modules/ contextual_test/ src/ Hook/ ContextualTestHooks.php 
- Implements hook_contextual_links_view_alter().
- SettingsTrayHooks::contextualLinksViewAlter in core/modules/ settings_tray/ src/ Hook/ SettingsTrayHooks.php 
- Implements hook_contextual_links_view_alter().
- ViewsUiHooks::contextualLinksViewAlter in core/modules/ views_ui/ src/ Hook/ ViewsUiHooks.php 
- Implements hook_contextual_links_view_alter().
1 invocation of hook_contextual_links_view_alter()
- contextual_pre_render_links in modules/contextual/ contextual.module 
- Build a renderable array for contextual links.
File
- 
              modules/contextual/ contextual.api.php, line 32 
Code
function hook_contextual_links_view_alter(&$element, $items) {
  // Add another class to all contextual link lists to facilitate custom
  // styling.
  $element['#attributes']['class'][] = 'custom-class';
}Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.
