You are here

public function SearchApiFieldTrait::renderItems in Search API 8

Renders all items in this field together.

Parameters

array|\ArrayAccess $items: The items provided by getItems() for a single row.

Return value

string The rendered items.

See also

\Drupal\views\Plugin\views\field\PrerenderList::renderItems()

1 method overrides SearchApiFieldTrait::renderItems()
SearchApiEntityField::renderItems in src/Plugin/views/field/SearchApiEntityField.php
Renders all items in this field together.

File

src/Plugin/views/field/SearchApiFieldTrait.php, line 1229

Class

SearchApiFieldTrait
Provides a trait to use for Search API Views field handlers.

Namespace

Drupal\search_api\Plugin\views\field

Code

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