示例#1
0
 private function getAllLibraries()
 {
     $modules = $this->moduleHandler->getModuleList();
     $themes = $this->themeHandler->rebuildThemeData();
     $extensions = array_merge($modules, $themes);
     $libraries = [];
     foreach ($extensions as $extensionName => $extension) {
         $libraryFile = $extension->getPath() . '/' . $extensionName . '.libraries.yml';
         if (is_file($this->appRoot . '/' . $libraryFile)) {
             $libraries[$extensionName] = $this->libraryDiscovery->getLibrariesByExtension($extensionName);
         }
     }
     return array_keys($libraries);
 }
示例#2
0
 /**
  * Gets all libraries for core and all installed modules.
  *
  * @return array[]
  *   An associative array of libraries keyed by extension, then by library
  *   name, and so on.
  */
 protected function getAllLibraries()
 {
     $modules = \Drupal::moduleHandler()->getModuleList();
     $module_list = array_keys($modules);
     sort($module_list);
     $this->assertEqual($this->allModules, $module_list, 'All core modules are installed.');
     $libraries['core'] = $this->libraryDiscovery->getLibrariesByExtension('core');
     $root = \Drupal::root();
     foreach ($modules as $module_name => $module) {
         $library_file = $module->getPath() . '/' . $module_name . '.libraries.yml';
         if (is_file($root . '/' . $library_file)) {
             $libraries[$module_name] = $this->libraryDiscovery->getLibrariesByExtension($module_name);
         }
     }
     return $libraries;
 }