attachTo example

$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();
    if ($plugin = $clone->display_handler->getPlugin('style')) {
      $plugin->attachTo($build$display_id$clone->getUrl()$clone->getTitle());
      foreach ($clone->feedIcons as $feed_icon) {
        $this->view->feedIcons[] = $feed_icon;
      }
    }

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

  /** * {@inheritdoc} */
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 that the user has access to.       if ($display_handler->isEnabled() && $display_handler->access()) {
        $cloned_view = Views::executableFactory()->get($this->storage);
        $display_handler->attachTo($cloned_view$this->current_display, $this->element);
      }
    }
    $this->is_attachment = FALSE;
  }

  /** * Determines if the given user has access to the view. * * Note that this sets the display handler if it hasn't been set. * * @param string $displays * The machine name of the display. * @param \Drupal\Core\Session\AccountInterface $account * The user object. * * @return bool * TRUE if the user has access to the view, FALSE otherwise. */
Home | Imprint | This part of the site doesn't use cookies.