You are here

public function DataExport::attachTo in Views data export 8

Same name in this branch
  1. 8 src/Plugin/views/display/DataExport.php \Drupal\views_data_export\Plugin\views\display\DataExport::attachTo()
  2. 8 src/Plugin/views/style/DataExport.php \Drupal\views_data_export\Plugin\views\style\DataExport::attachTo()

Allows displays to attach to other views.

Parameters

\Drupal\views\ViewExecutable $view: The views executable.

string $display_id: The display to attach to.

array $build: The parent view render array.

Overrides DisplayPluginBase::attachTo

File

src/Plugin/views/display/DataExport.php, line 539

Class

DataExport
Provides a data export display plugin.

Namespace

Drupal\views_data_export\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();
  $displays = $clone->storage
    ->get('display');
  $title = $clone
    ->getTitle();
  if (!empty($displays[$this->display['id']])) {
    $title = $displays[$this->display['id']]['display_title'];
  }
  if ($plugin = $clone->display_handler
    ->getPlugin('style')) {
    $plugin
      ->attachTo($build, $display_id, $clone
      ->getUrl(), $title);
    foreach ($clone->feedIcons as $feed_icon) {
      $this->view->feedIcons[] = $feed_icon;
    }
  }

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