public function SearchApiEntity::getItems in Search API 8
Gets an array of items for the field.
Items should be associative arrays with, if possible, "value" as the actual displayable value of the item, plus any items that might be found in the "alter" options array for creating links, etc., such as "path", "fragment", "query", etc. Additionally, items that might be turned into tokens should also be in this array.
Parameters
\Drupal\views\ResultRow $values: The result row object containing the values.
Return value
array[] An array of items for the field, with each item being an array itself.
Overrides SearchApiFieldTrait::getItems
See also
\Drupal\views\Plugin\views\field\PrerenderList::getItems()
File
- src/
Plugin/ views/ field/ SearchApiEntity.php, line 267
Class
- SearchApiEntity
- Handles the display of entity reference fields in Search API Views.
Namespace
Drupal\search_api\Plugin\views\fieldCode
public function getItems(ResultRow $values) {
$property_path = $this
->getCombinedPropertyPath();
if (!empty($values->{$property_path})) {
$items = [];
foreach ((array) $values->{$property_path} as $value) {
if ($value instanceof EntityInterface) {
$item = $this
->getItem($value);
if ($item) {
$items[] = $item;
}
}
}
return $items;
}
return [];
}