function Feed::optionsSummary

Same name in other branches
  1. 9 core/modules/views/src/Plugin/views/display/Feed.php \Drupal\views\Plugin\views\display\Feed::optionsSummary()
  2. 10 core/modules/views/src/Plugin/views/display/Feed.php \Drupal\views\Plugin\views\display\Feed::optionsSummary()
  3. 11.x core/modules/views/src/Plugin/views/display/Feed.php \Drupal\views\Plugin\views\display\Feed::optionsSummary()

Overrides PathPluginBase::optionsSummary

File

core/modules/views/src/Plugin/views/display/Feed.php, line 220

Class

Feed
The plugin that handles a feed, such as RSS or atom.

Namespace

Drupal\views\Plugin\views\display

Code

public function optionsSummary(&$categories, &$options) {
    parent::optionsSummary($categories, $options);
    // Since we're childing off the 'path' type, we'll still *call* our
    // category 'page' but let's override it so it says feed settings.
    $categories['page'] = [
        'title' => $this->t('Feed settings'),
        'column' => 'second',
        'build' => [
            '#weight' => -10,
        ],
    ];
    if ($this->getOption('sitename_title')) {
        $options['title']['value'] = $this->t('Using the site name');
    }
    $displays = array_filter($this->getOption('displays'));
    if (count($displays) > 1) {
        $attach_to = $this->t('Multiple displays');
    }
    elseif (count($displays) == 1) {
        $display = array_shift($displays);
        $displays = $this->view->storage
            ->get('display');
        if (!empty($displays[$display])) {
            $attach_to = $displays[$display]['display_title'];
        }
    }
    if (!isset($attach_to)) {
        $attach_to = $this->t('None');
    }
    $options['displays'] = [
        'category' => 'page',
        'title' => $this->t('Attach to'),
        'value' => $attach_to,
    ];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.