function PrerenderList::renderItems
Same name in other branches
- 9 core/modules/views/src/Plugin/views/field/PrerenderList.php \Drupal\views\Plugin\views\field\PrerenderList::renderItems()
- 8.9.x core/modules/views/src/Plugin/views/field/PrerenderList.php \Drupal\views\Plugin\views\field\PrerenderList::renderItems()
- 10 core/modules/views/src/Plugin/views/field/PrerenderList.php \Drupal\views\Plugin\views\field\PrerenderList::renderItems()
Overrides MultiItemsFieldHandlerInterface::renderItems
File
-
core/
modules/ views/ src/ Plugin/ views/ field/ PrerenderList.php, line 74
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);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.