Mercurial > hg > isophonics-drupal-site
diff core/lib/Drupal/Core/Extension/ModuleHandler.php @ 17:129ea1e6d783
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:21:36 +0000 |
parents | 1fec387a4317 |
children | af1871eacc83 |
line wrap: on
line diff
--- a/core/lib/Drupal/Core/Extension/ModuleHandler.php Tue Jul 10 15:07:59 2018 +0100 +++ b/core/lib/Drupal/Core/Extension/ModuleHandler.php Thu Feb 28 13:21:36 2019 +0000 @@ -5,6 +5,7 @@ use Drupal\Component\Graph\Graph; use Drupal\Component\Utility\NestedArray; use Drupal\Core\Cache\CacheBackendInterface; +use Drupal\Core\Extension\Exception\UnknownExtensionException; /** * Class that manages modules in a Drupal installation. @@ -172,7 +173,7 @@ if (isset($this->moduleList[$name])) { return $this->moduleList[$name]; } - throw new \InvalidArgumentException(sprintf('The module %s does not exist.', $name)); + throw new UnknownExtensionException(sprintf('The module %s does not exist.', $name)); } /** @@ -429,7 +430,6 @@ return $result; } - /** * Triggers an E_USER_DEPRECATED error if any module implements the hook. * @@ -777,8 +777,12 @@ * {@inheritdoc} */ public function getName($module) { - $info = system_get_info('module', $module); - return isset($info['name']) ? $info['name'] : $module; + try { + return \Drupal::service('extension.list.module')->getName($module); + } + catch (UnknownExtensionException $e) { + return $module; + } } }