public function BookSitemapDeriver::getDerivativeDefinitions in Sitemap 8.2
Same name and namespace in other branches
- 2.0.x src/Plugin/Derivative/BookSitemapDeriver.php \Drupal\sitemap\Plugin\Derivative\BookSitemapDeriver::getDerivativeDefinitions()
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/ Derivative/ BookSitemapDeriver.php, line 46
Class
Namespace
Drupal\sitemap\Plugin\DerivativeCode
public function getDerivativeDefinitions($base_plugin_definition) {
if (\Drupal::moduleHandler()
->moduleExists('book')) {
foreach ($this->bookManager
->getAllBooks() as $id => $book) {
$this->derivatives[$id] = $base_plugin_definition;
$this->derivatives[$id]['title'] = t('Book: @book', [
'@book' => $book['title'],
]);
$this->derivatives[$id]['description'] = $book['type'];
$this->derivatives[$id]['settings']['title'] = '';
$this->derivatives[$id]['book'] = $id;
$this->derivatives[$id]['config_dependencies']['config'] = [
'book.settings',
];
}
}
return $this->derivatives;
}