You are here

public function PrerenderList::renderItems in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/views/src/Plugin/views/field/PrerenderList.php \Drupal\views\Plugin\views\field\PrerenderList::renderItems()

Render all items in this field together.

Parameters

array $items: The items provided by getItems for a single row.

Return value

string The rendered items.

Overrides MultiItemsFieldHandlerInterface::renderItems

File

core/modules/views/src/Plugin/views/field/PrerenderList.php, line 78
Contains \Drupal\views\Plugin\views\field\PrerenderList.

Class

PrerenderList
Field handler to provide a list of items.

Namespace

Drupal\views\Plugin\views\field

Code

public function renderItems($items) {
  if (!empty($items)) {
    if ($this->options['type'] == 'separator') {
      $render = [
        '#type' => 'inline_template',
        '#template' => '{{ items|safe_join(separator) }}',
        '#context' => [
          'items' => $items,
          'separator' => $this
            ->sanitizeValue($this->options['separator'], 'xss_admin'),
        ],
      ];
    }
    else {
      $render = array(
        '#theme' => 'item_list',
        '#items' => $items,
        '#title' => NULL,
        '#list_type' => $this->options['type'],
      );
    }
    return drupal_render($render);
  }
}