function DisplayPluginBase::render

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()
  2. 8.9.x core/modules/views/src/Plugin/views/display/DisplayPluginBase.php \Drupal\views\Plugin\views\display\DisplayPluginBase::render()
  3. 11.x core/modules/views/src/Plugin/views/display/DisplayPluginBase.php \Drupal\views\Plugin\views\display\DisplayPluginBase::render()

Renders this display.

Return value

array A render array.

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 2176

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() : [];
  $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;
}

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