You are here

function contextual_contextual_links_view_alter in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/contextual/contextual.module \contextual_contextual_links_view_alter()
  2. 9 core/modules/contextual/contextual.module \contextual_contextual_links_view_alter()

Implements hook_contextual_links_view_alter().

See also

\Drupal\contextual\Plugin\views\field\ContextualLinks::render()

File

core/modules/contextual/contextual.module, line 147
Adds contextual links to perform actions related to elements on a page.

Code

function contextual_contextual_links_view_alter(&$element, $items) {
  if (isset($element['#contextual_links']['contextual'])) {
    $encoded_links = $element['#contextual_links']['contextual']['metadata']['contextual-views-field-links'];
    $element['#links'] = Json::decode(rawurldecode($encoded_links));
  }
}