public function ProcessorsService::getPluginsEnabled in Purge 8.3
Retrieve the configured plugin_ids that the service will use.
Return value
string[] Array with the plugin_ids of the enabled plugins.
Overrides ServiceBase::getPluginsEnabled
File
- src/
Plugin/ Purge/ Processor/ ProcessorsService.php, line 64
Class
- ProcessorsService
- Provides a service that provides access to loaded processors.
Namespace
Drupal\purge\Plugin\Purge\ProcessorCode
public function getPluginsEnabled() {
if (is_null($this->pluginsEnabled)) {
// Build a mapping of all plugins and whether they are enabled by default.
$this->pluginsEnabled = [];
foreach ($this
->getPlugins() as $plugin_id => $definition) {
$enable_by_default = $definition['enable_by_default'] === TRUE;
$this->pluginsEnabled[$plugin_id] = $enable_by_default;
}
// Override the mapping with information stored in CMI, then filter out
// everything that isn't enabled and finally flip the array with just ids.
$processors = $this->configFactory
->get('purge.plugins')
->get('processors');
if (!is_null($processors)) {
foreach ($processors as $setting) {
if (isset($this->pluginsEnabled[$setting['plugin_id']])) {
$this->pluginsEnabled[$setting['plugin_id']] = $setting['status'];
}
}
}
foreach ($this->pluginsEnabled as $plugin_id => $status) {
if (!$status) {
unset($this->pluginsEnabled[$plugin_id]);
}
}
$this->pluginsEnabled = array_keys($this->pluginsEnabled);
}
return $this->pluginsEnabled;
}