function views_ui_contextual_links_view_alter

3.x views_ui.module views_ui_contextual_links_view_alter(&$element, $items)

Implements hook_contextual_links_view_alter().

File

./views_ui.module, line 672
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']['views-ui-edit']) && !empty($element['#element']['#views_contextual_links_info']['views_ui']['view_display_id'])) {
    $display_id = $element['#element']['#views_contextual_links_info']['views_ui']['view_display_id'];
    $element['#links']['views-ui-edit']['href'] .= '/' . $display_id;
  }
}