public function PrerenderList::renderItems in Drupal 9
Same name and namespace in other branches
- 8 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 73
Class
- PrerenderList
- Field handler to provide a list of items.
Namespace
Drupal\views\Plugin\views\fieldCode
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 = [
'#theme' => 'item_list',
'#items' => $items,
'#title' => NULL,
'#list_type' => $this->options['type'],
];
}
return \Drupal::service('renderer')
->render($render);
}
}