public function ViewExecutable::attachDisplays

Run attachment displays for the view.

1 call to ViewExecutable::attachDisplays()
ViewExecutable::build in drupal/core/modules/views/lib/Drupal/views/ViewExecutable.php
Build the query for the view.

File

drupal/core/modules/views/lib/Drupal/views/ViewExecutable.php, line 1419
Definition of Drupal\views\ViewExecutable.

Class

ViewExecutable
An object to contain all of the data to generate a view, plus the member functions to build the view query, execute the query and render the output.

Namespace

Drupal\views

Code

public function attachDisplays() {
  if (!empty($this->is_attachment)) {
    return;
  }
  if (!$this->display_handler
    ->acceptAttachments()) {
    return;
  }
  $this->is_attachment = TRUE;

  // Find out which other displays attach to the current one.
  foreach ($this->display_handler
    ->getAttachedDisplays() as $id) {

    // Create a clone for the attachments to manipulate. 'static' refers to the current class name.
    $cloned_view = new static($this->storage);
    $this->displayHandlers
      ->get($id)
      ->attachTo($cloned_view, $this->current_display);
  }
  $this->is_attachment = FALSE;
}