function Feed::attachTo

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

Overrides DisplayPluginBase::attachTo

File

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

Class

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

Namespace

Drupal\views\Plugin\views\display

Code

public function attachTo(ViewExecutable $view, $display_id, array &$build) {
    $displays = $this->getOption('displays');
    if (empty($displays[$display_id])) {
        return;
    }
    // Defer to the feed style; it may put in meta information, and/or
    // attach a feed icon.
    $view->setArguments($this->view->args);
    $view->setDisplay($this->display['id']);
    $view->buildTitle();
    if ($plugin = $view->display_handler
        ->getPlugin('style')) {
        $plugin->attachTo($build, $display_id, $view->getUrl(), $view->getTitle());
        foreach ($view->feedIcons as $feed_icon) {
            $this->view->feedIcons[] = $feed_icon;
        }
    }
}

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