function views_ui_view_preview_section_handler_links

Returns contextual links for each handler of a certain section.

@TODO Bring in relationships Refactor this function to use much stuff of views_ui_edit_form_get_bucket.

Parameters

$title: Add a bolded title of this section.

2 calls to views_ui_view_preview_section_handler_links()
template_preprocess_views_ui_view_preview_section in drupal/core/modules/views/views_ui/theme/theme.inc
Theme preprocess for theme_views_ui_view_preview_section().
views_ui_view_preview_section_rows_links in drupal/core/modules/views/views_ui/views_ui.module
Returns all contextual links for the main content part of the view.

File

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

Code

function views_ui_view_preview_section_handler_links(ViewUI $view, $type, $title = FALSE) {
  $display = $view->executable->display_handler->display;
  $handlers = $view->executable->display_handler
    ->getHandlers($type);
  $links = array();
  $types = ViewExecutable::viewsHandlerTypes();
  if ($title) {
    $links[$type . '-title'] = array(
      'title' => $types[$type]['title'],
    );
  }
  foreach ($handlers as $id => $handler) {
    $field_name = $handler
      ->adminLabel(TRUE);
    $links[$type . '-edit-' . $id] = array(
      'title' => t('Edit @section', array(
        '@section' => $field_name,
      )),
      'href' => "admin/structure/views/nojs/config-item/{$view->get('name')}/{$display['id']}/{$type}/{$id}",
      'attributes' => array(
        'class' => array(
          'views-ajax-link',
        ),
      ),
    );
  }
  $links[$type . '-add'] = array(
    'title' => t('Add new'),
    'href' => "admin/structure/views/nojs/add-item/{$view->get('name')}/{$display['id']}/{$type}",
    'attributes' => array(
      'class' => array(
        'views-ajax-link',
      ),
    ),
  );
  return $links;
}