public function Layer::attachTo in Geolocation Field 8.3
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 Attachment::attachTo
File
- src/
Plugin/ views/ display/ Layer.php, line 111
Class
- Layer
- The plugin that handles an attachment display.
Namespace
Drupal\geolocation\Plugin\views\displayCode
public function attachTo(ViewExecutable $view, $display_id, array &$build) {
$displays = $this
->getOption('displays');
if (empty($displays[$display_id])) {
return;
}
if (!$this
->access()) {
return;
}
$args = $this
->getOption('inherit_arguments') ? $this->view->args : [];
$view
->setArguments($args);
$view
->setDisplay($this->display['id']);
if ($this
->getOption('inherit_pager')) {
$view->display_handler->usesPager = $this->view->displayHandlers
->get($display_id)
->usesPager();
$view->display_handler
->setOption('pager', $this->view->displayHandlers
->get($display_id)
->getOption('pager'));
}
if (empty($this->view->geolocationLayers[$display_id])) {
$this->view->geolocationLayers[$display_id] = [];
}
$this->view->geolocationLayers[$display_id][] = $view
->buildRenderable($this->display['id'], $args);
}