You are here

DefaultRevisionedDisplay.php in Config Entity Revisions 8.2

File

modules/view_revisions/src/Plugin/views/display/DefaultRevisionedDisplay.php
View source
<?php

namespace Drupal\views\Plugin\views\display;


/**
 * Class DefaultRevisionedDisplay
 *
 * @package Drupal\views\Plugin\views\display
 */
class DefaultRevisionedDisplay extends DefaultDisplay {

  /**
   * {@inheritdoc}
   */
  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 \Drupal::l($text, new Url('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),
      ],
    ]));
  }

}

Classes

Namesort descending Description
DefaultRevisionedDisplay Class DefaultRevisionedDisplay