function DevelGeneratePluginManager::findDefinitions

Same name in other branches
  1. 5.x devel_generate/src/DevelGeneratePluginManager.php \Drupal\devel_generate\DevelGeneratePluginManager::findDefinitions()

Overrides DefaultPluginManager::findDefinitions

File

devel_generate/src/DevelGeneratePluginManager.php, line 34

Class

DevelGeneratePluginManager
Plugin type manager for DevelGenerate plugins.

Namespace

Drupal\devel_generate

Code

protected function findDefinitions() {
    $definitions = [];
    foreach (parent::findDefinitions() as $plugin_id => $plugin_definition) {
        $plugin_available = TRUE;
        foreach ($plugin_definition['dependencies'] as $module_name) {
            // If a plugin defines module dependencies and at least one module is
            // not installed don't make this plugin available.
            if (!$this->moduleHandler
                ->moduleExists($module_name)) {
                $plugin_available = FALSE;
                break;
            }
        }
        if ($plugin_available) {
            $definitions[$plugin_id] = $plugin_definition;
        }
    }
    return $definitions;
}