function views_ui_contextual_links_view_alter
Same name in other branches
- 8.9.x core/modules/views_ui/views_ui.module \views_ui_contextual_links_view_alter()
- 10 core/modules/views_ui/views_ui.module \views_ui_contextual_links_view_alter()
- 11.x core/modules/views_ui/views_ui.module \views_ui_contextual_links_view_alter()
Implements hook_contextual_links_view_alter().
File
-
core/
modules/ views_ui/ views_ui.module, line 254
Code
function views_ui_contextual_links_view_alter(&$element, $items) {
// Remove contextual links from being rendered, when so desired, such as
// within a View preview.
if (views_ui_contextual_links_suppress()) {
$element['#links'] = [];
}
elseif (!empty($element['#links']['entityviewedit-form'])) {
$display_id = $items['entity.view.edit_form']['metadata']['display_id'];
$route_parameters = $element['#links']['entityviewedit-form']['url']->getRouteParameters() + [
'display_id' => $display_id,
];
$element['#links']['entityviewedit-form']['url'] = Url::fromRoute('entity.view.edit_display_form', $route_parameters);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.