protected function SearchApiPageDeriver::getDerivatives in Search API Pages 8
Creates derived plugin definitions for pages.
Parameters
\Drupal\search_api_page\SearchApiPageInterface[] $pages: The pages to create plugins for.
array $base_plugin_definition: The plugin definition for this plugin.
Return value
array Returns an array of plugin definitions, keyed by derivative ID.
1 call to SearchApiPageDeriver::getDerivatives()
- SearchApiPageDeriver::getDerivativeDefinitions in src/
Plugin/ search_api/ display/ SearchApiPageDeriver.php - Gets the definition of all derivatives of a base plugin.
File
- src/
Plugin/ search_api/ display/ SearchApiPageDeriver.php, line 43
Class
- SearchApiPageDeriver
- Derives a display plugin definition for all pages.
Namespace
Drupal\search_api_page\Plugin\search_api\displayCode
protected function getDerivatives(array $pages, array $base_plugin_definition) {
$plugin_derivatives = [];
foreach ($pages as $page) {
$label = $page
->label();
$description = $this
->t('The %label search page.', [
'%label' => $label,
]);
$plugin_derivatives[$page
->id()] = [
'label' => $label,
'description' => $description,
'index' => $page
->getIndex(),
'path' => '/' . $page
->getPath(),
] + $base_plugin_definition;
}
return $plugin_derivatives;
}