You are here

protected function Fields::renderFieldsIntoRegions in Layout Plugin Views 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/views/row/Fields.php \Drupal\layout_plugin_views\Plugin\views\row\Fields::renderFieldsIntoRegions()

Renders the row's fields into the regions specified in the region map.

Parameters

\Drupal\views\ResultRow $row:

Return value

\Drupal\Component\Render\MarkupInterface[] An array of MarkupInterface objects keyed by region machine name.

1 call to Fields::renderFieldsIntoRegions()
Fields::render in src/Plugin/views/row/Fields.php
Render a row object. This usually passes through to a theme template of some form, but not always.

File

src/Plugin/views/row/Fields.php, line 141

Class

Fields
The layout_plugin_views 'fields' row plugin

Namespace

Drupal\layout_plugin_views\Plugin\views\row

Code

protected function renderFieldsIntoRegions(ResultRow $row) {
  $build = [];
  foreach ($this
    ->getRegionMap()
    ->getNonEmptyRegionNames() as $region_name) {
    try {
      $fieldsToRender = $this
        ->getRegionMap()
        ->getFieldsForRegion($region_name);
      $build[$region_name]['#markup'] = $this
        ->renderFields($row, $fieldsToRender);
    } catch (NoMarkupGeneratedException $e) {

      // Even though we only try to render regions that actually contain
      // fields, it is still possible that those fields are empty. We don't
      // want to render empty regions, so we do nothing.
    }
  }
  return $build;
}