Adds derivatives to a list of plugin definitions.
This should be called by the class extending this in DiscoveryInterface::getDefinitions().
protected function getDerivatives(array $base_plugin_definitions) {
$plugin_definitions = array();
foreach ($base_plugin_definitions as $base_plugin_id => $plugin_definition) {
$derivative_fetcher = $this
->getDerivativeFetcher($base_plugin_id, $plugin_definition);
if ($derivative_fetcher) {
$derivative_definitions = $derivative_fetcher
->getDerivativeDefinitions($plugin_definition);
foreach ($derivative_definitions as $derivative_id => $derivative_definition) {
$plugin_id = $this
->encodePluginId($base_plugin_id, $derivative_id);
$plugin_definitions[$plugin_id] = $derivative_definition;
}
}
else {
$plugin_definitions[$base_plugin_id] = $plugin_definition;
}
}
return $plugin_definitions;
}