views_ui_contextual_links_view_alter

views_ui_contextual_links_view_alter(&$element, $items)

Implements hook_contextual_links_view_alter().

File

core/modules/views_ui/views_ui.module, line 231
Provide structure for the administrative interface to Views.

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'] = array();
  }
  // Append the display ID to the Views UI edit links, so that clicking on the
  // contextual link takes you directly to the correct display tab on the edit
  // screen.
  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);
  }
}
doc_Drupal
2016-10-29 09:55:42
Comments
Leave a Comment

Please login to continue.