public function WarmerPluginManager::getWarmers in Warmer 8
Same name and namespace in other branches
- 2.x src/Plugin/WarmerPluginManager.php \Drupal\warmer\Plugin\WarmerPluginManager::getWarmers()
Instantiates all the warmer plugins.
Return value
\Drupal\warmer\Plugin\WarmerPluginBase[] The plugin instances.
File
- src/
Plugin/ WarmerPluginManager.php, line 39
Class
- WarmerPluginManager
- Manager for the warmer plugins.
Namespace
Drupal\warmer\PluginCode
public function getWarmers($plugin_ids = NULL) {
if (!$plugin_ids) {
$definitions = $this
->getDefinitions();
$plugin_ids = array_map(function ($definition) {
return empty($definition) ? NULL : $definition['id'];
}, $definitions);
$plugin_ids = array_filter(array_values($plugin_ids));
}
$warmers = array_map(function ($plugin_id) {
try {
return $this
->createInstance($plugin_id);
} catch (PluginException $exception) {
return NULL;
}
}, $plugin_ids);
return array_filter($warmers, function ($warmer) {
return $warmer instanceof WarmerPluginBase;
});
}