You are here

public function DisplayPluginBase::renderArea 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::renderArea()

Renders one of the available areas.

Parameters

string $area: Identifier of the specific area to render.

bool $empty: (optional) Indicator whether or not the view result is empty. Defaults to FALSE

Return value

array A render array for the given area.

Overrides DisplayPluginInterface::renderArea

File

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

Class

DisplayPluginBase
Base class for views display plugins.

Namespace

Drupal\views\Plugin\views\display

Code

public function renderArea($area, $empty = FALSE) {
  $return = [];
  foreach ($this
    ->getHandlers($area) as $key => $area_handler) {
    if ($area_render = $area_handler
      ->render($empty)) {
      if (isset($area_handler->position)) {

        // Fix weight of area.
        $area_render['#weight'] = $area_handler->position;
      }
      $return[$key] = $area_render;
    }
  }
  return $return;
}