Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. DisplayPluginBase.php

function DisplayPluginBase::optionLink

Overrides DisplayPluginInterface::optionLink

1 call to DisplayPluginBase::optionLink()
DisplayPluginBase::buildOptionsForm in core/modules/views/src/Plugin/views/display/DisplayPluginBase.php
Provide a form to edit options for this plugin.

File

core/modules/views/src/Plugin/views/display/DisplayPluginBase.php, line 1025

Class

DisplayPluginBase
Base class for views display plugins.

Namespace

Drupal\views\Plugin\views\display

Code

public function optionLink($text, $section, $class = '', $title = '') {
    if (!trim($text)) {
        $text = $this->t('Broken field');
    }
    if (!empty($class)) {
        $text = new FormattableMarkup('<span>@text</span>', [
            '@text' => $text,
        ]);
    }
    if (empty($title)) {
        $title = $text;
    }
    return Link::fromTextAndUrl($text, Url::fromRoute('views_ui.form_display', [
        'js' => 'nojs',
        'view' => $this->view->storage
            ->id(),
        'display_id' => $this->display['id'],
        'type' => $section,
    ], [
        'attributes' => [
            'class' => [
                'views-ajax-link',
                $class,
            ],
            'title' => $title,
            'id' => Html::getUniqueId('views-' . $this->display['id'] . '-' . $section),
        ],
    ]))
        ->toString();
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal