function 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 stuff of views_ui_edit_form_get_bucket.
Parameters
bool $title: Add a bolded title of this section.
Deprecated
in drupal:11.3.0 and is removed from drupal:12.0.0. There is no replacement.
See also
https://www.drupal.org/node/3535324
1 call to views_ui_view_preview_section_handler_links()
- views_ui_view_preview_section_rows_links in core/
modules/ views_ui/ views_ui.module - Returns all contextual links for the main content part of the view.
File
-
core/
modules/ views_ui/ views_ui.module, line 26
Code
function views_ui_view_preview_section_handler_links(ViewExecutable $view, $type, $title = FALSE) : array {
@trigger_error(__FUNCTION__ . '() is deprecated in drupal:11.3.0 and is removed from drupal:12.0.0. There is no replacement. See https://www.drupal.org/node/3535324', E_USER_DEPRECATED);
$display = $view->display_handler->display;
$handlers = $view->display_handler
->getHandlers($type);
$links = [];
$types = ViewExecutable::getHandlerTypes();
if ($title) {
$links[$type . '-title'] = [
'title' => $types[$type]['title'],
];
}
foreach ($handlers as $id => $handler) {
$field_name = $handler->adminLabel(TRUE);
$links[$type . '-edit-' . $id] = [
'title' => t('Edit @section', [
'@section' => $field_name,
]),
'url' => Url::fromRoute('views_ui.form_handler', [
'js' => 'nojs',
'view' => $view->storage
->id(),
'display_id' => $display['id'],
'type' => $type,
'id' => $id,
]),
'attributes' => [
'class' => [
'views-ajax-link',
],
],
];
}
$links[$type . '-add'] = [
'title' => t('Add new'),
'url' => Url::fromRoute('views_ui.form_add_handler', [
'js' => 'nojs',
'view' => $view->storage
->id(),
'display_id' => $display['id'],
'type' => $type,
]),
'attributes' => [
'class' => [
'views-ajax-link',
],
],
];
return $links;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.