protected function SkinPluginManager::getDiscovery in Skinr 8.2
Gets the plugin discovery.
Return value
\Drupal\Component\Plugin\Discovery\DiscoveryInterface
Overrides DefaultPluginManager::getDiscovery
File
- src/
SkinPluginManager.php, line 47 - Contains \Drupal\skinr\SkinPluginManager.
Class
- SkinPluginManager
- Manages plugins for configuration translation mappers.
Namespace
Drupal\skinrCode
protected function getDiscovery() {
if (!isset($this->discovery)) {
// Look at all themes and modules.
// @todo If the list of installed modules and themes is changed, new
// definitions are not picked up immediately and obsolete definitions
// are not removed, because the list of search directories is only
// compiled once in this constructor. The current code only works due to
// coincidence: The request that installs (for instance, a new theme)
// does not instantiate this plugin manager at the beginning of the
// request; when routes are being rebuilt at the end of the request,
// this service only happens to get instantiated with the updated list
// of installed themes.
$directories = array();
foreach ($this->moduleHandler
->getModuleList() as $name => $module) {
$directories[$name] = $module
->getPath() . '/' . self::PLUGIN_PATH;
}
foreach ($this->themeHandler
->listInfo() as $theme) {
$directories[$theme
->getName()] = $theme
->getPath() . '/' . self::PLUGIN_PATH;
}
// Check skins directories for *.yml files in module/theme roots.
$this->discovery = new SkinYamlDirectoryDiscovery($directories, 'skin_plugins', 'id');
$this->discovery
->addTranslatableProperty('title');
// $this->discovery = new InfoHookDecorator($this->discovery, 'skinr_info');
// $this->discovery = new ContainerDerivativeDiscoveryDecorator($this->discovery);
}
return $this->discovery;
}