public function SearchApiEntityFieldExport::renderItems in REST Views 2.0.x
Throws
\Exception
File
- modules/
rest_views_search_api/ src/ Plugin/ views/ field/ SearchApiEntityFieldExport.php, line 23
Class
- SearchApiEntityFieldExport
- Display Search API Content Datasource field data in a serialized display.
Namespace
Drupal\rest_views_search_api\Plugin\views\fieldCode
public function renderItems($items) {
if (!empty($items)) {
$items = $this
->prepareItemsByDelta($items);
// Render only those items that are renderable arrays.
foreach ($items as $i => $item) {
if (is_array($items[$i])) {
$items[$i] = $this->renderer
->render($item);
}
}
$data = $this->multiple ? $items : reset($items);
}
else {
// Render an empty field as an empty array or a null value.
$data = $this->multiple ? [] : NULL;
}
// Wrap the output in a data object to protect it from rendering.
return SerializedData::create($data);
}