function views_ui_view_preview_section_handler_links in Views (for Drupal 7) 8.3
Same name and namespace in other branches
- 7.3 views_ui.module \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 views_ui/
theme/ theme.inc - Theme preprocess for theme_views_ui_view_preview_section().
- views_ui_view_preview_section_rows_links in views_ui/
views_ui.module - Returns all contextual links for the main content part of the view.
File
- views_ui/
views_ui.module, line 401 - Provide structure for the administrative interface to Views.
Code
function views_ui_view_preview_section_handler_links(ViewUI $view, $type, $title = FALSE) {
$display = $view->display_handler->display;
$handlers = $view->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->storage->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->storage->name}/{$display['id']}/{$type}",
'attributes' => array(
'class' => array(
'views-ajax-link',
),
),
);
return $links;
}