public function DatasourcePluginBase::viewMultipleItems in Search API 8
Returns the render array for the provided items and view mode.
Parameters
\Drupal\Core\TypedData\ComplexDataInterface[] $items: The items to render.
string $view_mode: (optional) The view mode that should be used to render the items.
string|null $langcode: (optional) For which language the items should be rendered. Defaults to the language each item has been loaded in.
Return value
array A render array for displaying the items.
Overrides DatasourceInterface::viewMultipleItems
1 method overrides DatasourcePluginBase::viewMultipleItems()
- ContentEntity::viewMultipleItems in src/
Plugin/ search_api/ datasource/ ContentEntity.php - Returns the render array for the provided items and view mode.
File
- src/
Datasource/ DatasourcePluginBase.php, line 139
Class
- DatasourcePluginBase
- Defines a base class from which other datasources may extend.
Namespace
Drupal\search_api\DatasourceCode
public function viewMultipleItems(array $items, $view_mode, $langcode = NULL) {
$build = [];
foreach ($items as $key => $item) {
$build[$key] = $this
->viewItem($item, $view_mode, $langcode);
}
return $build;
}