/** * @return \Drupal\Core\Extension\Extension[] */ private function discoverModules() { /* * @todo Remove DrupalExtensionDiscovery subclass once * https://www.drupal.org/node/2503927 is fixed. */ $discovery = new DrupalExtensionDiscovery(\Drupal::root()); $discovery->reset(); return $discovery->scan('module'); }
/** * @param string $type * @return \Drupal\Core\Extension\Extension[] */ public function discoverExtensions($type = 'module') { $this->getDrupalHelper()->loadLegacyFile('/core/modules/system/system.module'); system_rebuild_module_data(); /* * @see Remove DrupalExtensionDiscovery subclass once * https://www.drupal.org/node/2503927 is fixed. */ $discovery = new DrupalExtensionDiscovery(\Drupal::root()); $discovery->reset(); return $discovery->scan($type); }
/** * @param string $moduleName * @return string */ public function getModulePath($moduleName) { if (!$this->modulePath) { /* * @todo Remove DrupalExtensionDiscovery subclass once * https://www.drupal.org/node/2503927 is fixed. */ $discovery = new DrupalExtensionDiscovery(\Drupal::root()); $discovery->reset(); $result = $discovery->scan('module'); $this->modulePath = DRUPAL_ROOT . '/' . $result[$moduleName]->getPath(); } return $this->modulePath; }