public function XmlFieldHelperTrait::renderItems in Views XML Backend 8
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.
See also
\Drupal\views\Plugin\views\field\MultiItemsFieldHandlerInterface
File
- src/
Plugin/ views/ field/ XmlFieldHelperTrait.php, line 106 - Contains \Drupal\views_xml_backend\Plugin\views\field\XmlFieldHelperTrait.
Class
- XmlFieldHelperTrait
- A handler to provide an XML text field.
Namespace
Drupal\views_xml_backend\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 = array(
'#theme' => 'item_list',
'#items' => $items,
'#title' => NULL,
'#list_type' => $this->options['type'],
);
}
return drupal_render($render);
}
}