public function SyncFilterDeriver::getDerivativeDefinitions in Configuration Synchronizer 8.2
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/ ConfigFilter/ SyncFilterDeriver.php, line 84
Class
- SyncFilterDeriver
- Deriver for SyncFilter filters.
Namespace
Drupal\config_sync\Plugin\ConfigFilterCode
public function getDerivativeDefinitions($base_plugin_definition) {
$plugin_data = $this->state
->get('config_sync.plugins', []);
$type_labels = [
'module' => $this
->t('Module'),
'theme' => $this
->t('Theme'),
];
foreach ($this->configSyncLister
->getExtensionChangelists() as $type => $extension_changelists) {
foreach (array_keys($extension_changelists) as $name) {
$key = $type . '_' . $name;
$this->derivatives[$key] = $base_plugin_definition;
$this->derivatives[$key]['extension_type'] = $type;
$this->derivatives[$key]['extension_name'] = $name;
switch ($type) {
case 'module':
$label = $this->moduleHandler
->getName($name);
$type_label = $this
->t('Module');
break;
case 'theme':
$label = $this->themeHandler
->getName($name);
$type_label = $this
->t('Theme');
break;
}
$this->derivatives[$key]['label'] = $this
->t('@type_label: @label', [
'@type_label' => $type_label,
'@label' => $label,
]);
// Status can be overridden in the state.
$this->derivatives[$key]['status'] = !isset($plugin_data[$type][$name]['status']) || $plugin_data[$type][$name]['status'] === TRUE;
}
}
return $this->derivatives;
}