public function TagsHeadersService::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/ TagsHeader/ TagsHeadersService.php, line 39
Class
- TagsHeadersService
- Provides a service that provides access to available tags headers.
Namespace
Drupal\purge\Plugin\Purge\TagsHeaderCode
public function getPluginsEnabled() {
if (!is_null($this->pluginsEnabled)) {
return $this->pluginsEnabled;
}
// We blindly load all tag header plugins that we discovered, but not
// when plugins put dependencies on purger plugins. When plugins do depend,
// we load 'purge.purgers' and verify if we should load them or not.
$load = function ($needles, $haystack) {
if (empty($needles)) {
return TRUE;
}
foreach ($needles as $needle) {
if (in_array($needle, $haystack)) {
return TRUE;
}
}
return FALSE;
};
$this->pluginsEnabled = [];
foreach ($this
->getPlugins() as $plugin) {
if (!empty($plugin['dependent_purger_plugins'])) {
if (!$load($plugin['dependent_purger_plugins'], $this
->getPurgers()
->getPluginsEnabled())) {
continue;
}
}
$this->pluginsEnabled[] = $plugin['id'];
}
return $this->pluginsEnabled;
}