Newscoop\Services\Plugins\ManagerService::getInstalledPlugins PHP Метод

getInstalledPlugins() публичный Метод

Get installed plugins
public getInstalledPlugins ( ) : array
Результат array Array with installed plugins info
    public function getInstalledPlugins()
    {
        $cachedAvailablePlugins = $this->pluginsDir . '/available_plugins.json';
        if (!file_exists($cachedAvailablePlugins)) {
            return array();
        }
        return $plugins = json_decode(file_get_contents($cachedAvailablePlugins));
    }

Usage Example

Пример #1
0
 public function load($resource, $type = null)
 {
     if (true === $this->loaded) {
         throw new \RuntimeException('Do not add this loader twice');
     }
     $routes = new \Symfony\Component\Routing\RouteCollection();
     $availablePlugins = $this->pluginsManager->getInstalledPlugins();
     $dirs = array();
     foreach ($availablePlugins as $plugin) {
         $pluginPath = explode('\\', $plugin);
         $directoryPath = realpath(__DIR__ . '/../../../../plugins/' . $pluginPath[0] . '/' . $pluginPath[1] . '/Resources/config/routing.yml');
         if ($directoryPath) {
             $dirs[] = realpath(__DIR__ . '/../../../../plugins/' . $pluginPath[0] . '/' . $pluginPath[1] . '/Resources/config/');
         }
     }
     $routesCollection = new \Symfony\Component\Routing\RouteCollection();
     foreach ($dirs as $directory) {
         $importedRoutes = $this->import($directory . '/routing.yml', 'yaml');
         $routesCollection->addCollection($importedRoutes);
     }
     return $routesCollection;
 }