You are here

public function DisplayPluginBase::render in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/views/src/Plugin/views/display/DisplayPluginBase.php \Drupal\views\Plugin\views\display\DisplayPluginBase::render()

Renders this display.

Overrides DisplayPluginInterface::render

3 methods override DisplayPluginBase::render()
EntityReference::render in core/modules/views/src/Plugin/views/display/EntityReference.php
Builds the view result as a renderable array.
Feed::render in core/modules/views/src/Plugin/views/display/Feed.php
Renders this display.
RestExport::render in core/modules/rest/src/Plugin/views/display/RestExport.php
Renders this display.

File

core/modules/views/src/Plugin/views/display/DisplayPluginBase.php, line 2169

Class

DisplayPluginBase
Base class for views display plugins.

Namespace

Drupal\views\Plugin\views\display

Code

public function render() {
  $rows = !empty($this->view->result) || $this->view->style_plugin
    ->evenEmpty() ? $this->view->style_plugin
    ->render($this->view->result) : [];
  $element = [
    '#theme' => $this
      ->themeFunctions(),
    '#view' => $this->view,
    '#pre_render' => [
      [
        $this,
        'elementPreRender',
      ],
    ],
    '#rows' => $rows,
    // Assigned by reference so anything added in $element['#attached'] will
    // be available on the view.
    '#attached' => &$this->view->element['#attached'],
    '#cache' => &$this->view->element['#cache'],
  ];
  $this
    ->applyDisplayCacheabilityMetadata($this->view->element);
  return $element;
}