public function load($resource, $type = null) { if ($this->loaded) { throw new \RuntimeException('The plugin routing loader must not be run twice'); } // Add the plugin routes $routes = new RouteCollection(); $plugins = Registry::getInstance($this->pluginPath)->getRoutedPlugins(); foreach ($plugins as $plugin => $routerFile) { $routes->addCollection($this->import($routerFile)); } $this->loaded = true; return $routes; }
/** * Read plugins from the directory * * @Annotations\Get("/plugins") * @ApiDoc( * description = "Get the plugins.", * resource = false, * statusCodes = { * 200 = "Returned when plugins successful returned" * } * ) * * @return View */ public function getPluginsAction() { $this->checkIsAdmin(); return View::create(PluginRegistry::getInstance($this->getParameter('nami_core.plugin_path'))->scanPlugins()); }
/** * {@inheritDoc} */ public function process(ContainerBuilder $container) { $pluginRegistry = PluginRegistry::getInstance(str_replace('%kernel.root_dir%', $container->getParameter('kernel.root_dir'), $container->getParameter('nami_core.plugin_path'))); $pluginRegistry->scanPlugins(); $pluginRegistry->registerConfig($container); }