function Feed::attachTo

Same name and namespace in other branches
  1. 9 core/modules/views/src/Plugin/views/display/Feed.php \Drupal\views\Plugin\views\display\Feed::attachTo()
  2. 10 core/modules/views/src/Plugin/views/display/Feed.php \Drupal\views\Plugin\views\display\Feed::attachTo()
  3. 11.x 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 328

Class

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

Namespace

Drupal\views\Plugin\views\display

Code

public function attachTo(ViewExecutable $clone, $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.
    $clone->setArguments($this->view->args);
    $clone->setDisplay($this->display['id']);
    $clone->buildTitle();
    if ($plugin = $clone->display_handler
        ->getPlugin('style')) {
        $plugin->attachTo($build, $display_id, $clone->getUrl(), $clone->getTitle());
        foreach ($clone->feedIcons as $feed_icon) {
            $this->view->feedIcons[] = $feed_icon;
        }
    }
    // Clean up.
    $clone->destroy();
    unset($clone);
}

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