You are here

public function Feed::attachTo in Views (for Drupal 7) 8.3

Attach to another view.

Overrides DisplayPluginBase::attachTo

File

lib/Drupal/views/Plugin/views/display/Feed.php, line 235
Definition of Drupal\views\Plugin\views\display\Feed.

Class

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

Namespace

Drupal\views\Plugin\views\display

Code

public function attachTo($display_id) {
  $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.
  $plugin = $this
    ->getPlugin('style');
  if ($plugin) {
    $clone = $this->view
      ->cloneView();
    $clone
      ->setDisplay($this->display['id']);
    $clone
      ->buildTitle();
    $plugin
      ->attach_to($display_id, $this
      ->getPath(), $clone
      ->getTitle());

    // Clean up
    $clone
      ->destroy();
    unset($clone);
  }
}