public function SearchApiPage::getViewModeConfiguration in Search API Pages 8
Get the view mode configuration per entity for rendering.
Return value
string[] A collection of view mode configuration.
Overrides SearchApiPageInterface::getViewModeConfiguration
File
- src/
Entity/ SearchApiPage.php, line 214
Class
- SearchApiPage
- Defines the Search page entity.
Namespace
Drupal\search_api_page\EntityCode
public function getViewModeConfiguration() {
/* @var $index \Drupal\search_api\IndexInterface */
$index = Index::load($this
->getIndex());
if ($index === NULL) {
return [];
}
$config = [];
foreach ($index
->getDatasources() as $dataSourceId => $datasource) {
$bundles = $datasource
->getBundles();
foreach ($bundles as $id => $label) {
$config[$dataSourceId . '_' . $id] = $this
->getViewModeConfig()
->getViewMode($dataSourceId, $id);
}
}
return $config;
}