public function ViewsDisplayDeriver::getDerivativeDefinitions in Search API 8
Gets the definition of all derivatives of a base plugin.
Parameters
array $base_plugin_definition: The definition array of the base plugin.
Return value
array An array of full derivative definitions keyed on derivative id.
Overrides DeriverBase::getDerivativeDefinitions
See also
getDerivativeDefinition()
File
- src/
Plugin/ search_api/ display/ ViewsDisplayDeriver.php, line 23
Class
- ViewsDisplayDeriver
- Derives a display plugin definition for all supported search view displays.
Namespace
Drupal\search_api\Plugin\search_api\displayCode
public function getDerivativeDefinitions($base_plugin_definition) {
if (!isset($this->derivatives)) {
$this->derivatives = [];
try {
/** @var \Drupal\Core\Entity\EntityStorageInterface $views_storage */
$views_storage = $this->entityTypeManager
->getStorage('view');
$all_views = $views_storage
->loadMultiple();
} catch (PluginNotFoundException $e) {
return $this->derivatives;
}
/** @var \Drupal\views\Entity\View $view */
foreach ($all_views as $view) {
$this->derivatives += $this
->getDisplaysForView($base_plugin_definition, $view, $this->derivatives);
}
}
return $this->derivatives;
}