diff --git a/core/lib/Drupal/Core/Asset/LibraryDiscoveryParser.php b/core/lib/Drupal/Core/Asset/LibraryDiscoveryParser.php index ef98adc..a3dbd82 100644 --- a/core/lib/Drupal/Core/Asset/LibraryDiscoveryParser.php +++ b/core/lib/Drupal/Core/Asset/LibraryDiscoveryParser.php @@ -65,13 +65,11 @@ public function buildByExtension($extension) { $path = $this->drupalGetPath($extension_type, $extension); } - $library_file = $path . '/' . $extension . '.libraries.yml'; - $libraries = $this->parseLibraryInfo($extension, $library_file); - + $libraries = $this->parseLibraryInfo($extension, $path); foreach ($libraries as $id => &$library) { if (!isset($library['js']) && !isset($library['css']) && !isset($library['settings'])) { - throw new IncompleteLibraryDefinitionException(sprintf("Incomplete library definition for '%s' in %s", $id, $library_file)); + throw new IncompleteLibraryDefinitionException(sprintf("Incomplete library definition for '%s'", $id)); } $library += array('dependencies' => array(), 'js' => array(), 'css' => array()); @@ -88,7 +86,7 @@ public function buildByExtension($extension) { // If this is a 3rd party library, the license info is required. if (isset($library['remote']) && !isset($library['license'])) { - throw new LibraryDefinitionMissingLicenseException(sprintf("Missing license information in library definition for '%s' in %s: it has a remote, but no license.", $id, $library_file)); + throw new LibraryDefinitionMissingLicenseException(sprintf("Missing license information in library definition for '%s': it has a remote, but no license.", $id)); } // Assign Drupal's license to libraries that don't have license info. @@ -209,8 +207,8 @@ public function buildByExtension($extension) { * * @param string $extension * The name of the extension that registered a library. - * @param string $library_file - * The relative filename to the DRUPAL_ROOT of the wanted library file. + * @param string $path + * The relative path to the extension. * * @return array * An array of parsed library data. @@ -218,8 +216,10 @@ public function buildByExtension($extension) { * @throws \Drupal\Core\Asset\Exception\InvalidLibraryFileException * Thrown when a parser exception got thrown. */ - protected function parseLibraryInfo($extension, $library_file) { + protected function parseLibraryInfo($extension, $path) { $libraries = []; + + $library_file = $path . '/' . $extension . '.libraries.yml'; if (file_exists(DRUPAL_ROOT . '/' . $library_file)) { try { $libraries = Yaml::decode(file_get_contents(DRUPAL_ROOT . '/' . $library_file));