You are here

public function Page::execute in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/views/src/Plugin/views/display/Page.php \Drupal\views\Plugin\views\display\Page::execute()

Executes the view and returns data in the format required.

The base class cannot be executed.

Overrides PathPluginBase::execute

File

core/modules/views/src/Plugin/views/display/Page.php, line 171
Contains \Drupal\views\Plugin\views\display\Page.

Class

Page
The plugin that handles a full page.

Namespace

Drupal\views\Plugin\views\display

Code

public function execute() {
  parent::execute();

  // And now render the view.
  $render = $this->view
    ->render();

  // First execute the view so it's possible to get tokens for the title.
  // And the title, which is much easier.
  // @todo Figure out how to support custom response objects. Maybe for pages
  //   it should be dropped.
  if (is_array($render)) {
    $render += array(
      '#title' => [
        '#markup' => $this->view
          ->getTitle(),
        '#allowed_tags' => Xss::getHtmlTagList(),
      ],
    );
  }
  return $render;
}