You are here

public function DisplayPluginBase::optionLink in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/views/src/Plugin/views/display/DisplayPluginBase.php \Drupal\views\Plugin\views\display\DisplayPluginBase::optionLink()

Returns a link to a section of a form.

Because forms may be split up into sections, this provides an easy URL to exactly the right section. Don't override this.

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 1017
Contains \Drupal\views\Plugin\views\display\DisplayPluginBase.

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 = SafeMarkup::format('<span>@text</span>', array(
      '@text' => $text,
    ));
  }
  if (empty($title)) {
    $title = $text;
  }
  return \Drupal::l($text, new Url('views_ui.form_display', array(
    'js' => 'nojs',
    'view' => $this->view->storage
      ->id(),
    'display_id' => $this->display['id'],
    'type' => $section,
  ), array(
    'attributes' => array(
      'class' => array(
        'views-ajax-link',
        $class,
      ),
      'title' => $title,
      'id' => Html::getUniqueId('views-' . $this->display['id'] . '-' . $section),
    ),
  )));
}