/** * Discovers the list of available plugins. */ protected function discoverPlugins() { $dir = "src/DrupalCI/Plugin/{$this->pluginType}"; $plugin_definitions = []; foreach (new \DirectoryIterator($dir) as $file) { if ($file->isDir() && !$file->isDot()) { $plugin_type = $file->getFilename(); $plugin_namespaces = ["DrupalCI\\Plugin\\{$this->pluginType}\\{$plugin_type}" => ["{$dir}/{$plugin_type}"]]; $discovery = new AnnotatedClassDiscovery($plugin_namespaces, 'Drupal\\Component\\Annotation\\PluginID'); $plugin_definitions[$plugin_type] = $discovery->getDefinitions(); } } return $plugin_definitions; }
/** * {@inheritdoc} */ protected function prepareAnnotationDefinition(AnnotationInterface $annotation, $class) { parent::prepareAnnotationDefinition($annotation, $class); if (!$annotation->getProvider()) { $annotation->setProvider($this->getProviderFromNamespace($class)); } }