You are here

function views_ui_view_preview_section_handler_links in Views (for Drupal 7) 7.3

Same name and namespace in other branches
  1. 8.3 views_ui/views_ui.module \views_ui_view_preview_section_handler_links()

Returns contextual links for each handler of a certain section.

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

Parameters

string $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 ./views_ui.module
Theme preprocess for theme_views_ui_view_preview_section().
views_ui_view_preview_section_rows_links in ./views_ui.module
Returns all contextual links for the main content part of the view.

File

./views_ui.module, line 529
Provide structure for the administrative interface to Views.

Code

function views_ui_view_preview_section_handler_links($view, $type, $title = FALSE) {
  $display = $view->display_handler->display;
  $handlers = $view->display_handler
    ->get_handlers($type);
  $links = array();
  $types = views_object_types();
  if ($title) {
    $links[$type . '-title'] = array(
      'title' => $types[$type]['title'],
    );
  }
  foreach ($handlers as $id => $handler) {
    $field_name = $handler
      ->ui_name(TRUE);
    $links[$type . '-edit-' . $id] = array(
      'title' => t('Edit @section', array(
        '@section' => $field_name,
      )),
      'href' => "admin/structure/views/nojs/config-item/{$view->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->name}/{$display->id}/{$type}",
    'attributes' => array(
      'class' => array(
        'views-ajax-link',
      ),
    ),
  );
  return $links;
}