ViewExecutable::attachDisplays

public ViewExecutable::attachDisplays()

Runs attachment displays for the view.

File

core/modules/views/src/ViewExecutable.php, line 1699

Class

ViewExecutable
Represents a view as a whole.

Namespace

Drupal\views

Code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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) {
    $display_handler = $this->displayHandlers->get($id);
    // Only attach enabled attachments.
    if ($display_handler->isEnabled()) {
      $cloned_view = Views::executableFactory()->get($this->storage);
      $display_handler->attachTo($cloned_view, $this->current_display, $this->element);
    }
  }
  $this->is_attachment = FALSE;
}
doc_Drupal
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.