function Page::execute

Same name and namespace in other branches
  1. 8.9.x core/modules/views/src/Plugin/views/display/Page.php \Drupal\views\Plugin\views\display\Page::execute()
  2. 10 core/modules/views/src/Plugin/views/display/Page.php \Drupal\views\Plugin\views\display\Page::execute()
  3. 11.x core/modules/views/src/Plugin/views/display/Page.php \Drupal\views\Plugin\views\display\Page::execute()

Overrides PathPluginBase::execute

File

core/modules/views/src/Plugin/views/display/Page.php, line 195

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 += [
            '#title' => [
                '#markup' => $this->view
                    ->getTitle(),
                '#allowed_tags' => Xss::getHtmlTagList(),
            ],
        ];
    }
    return $render;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.