Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Example by hook (or by libraries.yml, no difference)
function HOOK_preprocess_html(&$variables) {
$variables['page']['#attached']['library'][] = 'modules/lololo';
}
Result:
User warning: The following theme is missing from the file system: modules in drupal_get_filename() (line 233 of core/includes/bootstrap.inc).
drupal_get_filename('theme', 'modules') (Line: 256)
drupal_get_path('theme', 'modules') (Line: 390)
Drupal\Core\Asset\LibraryDiscoveryParser->drupalGetPath('theme', 'modules') (Line: 85)
...
Not 'theme', but 'library' problem.
Probably because there are not enough conditions in LibraryDiscoveryParser (line 79):
if ($this->moduleHandler->moduleExists($extension)) {
$extension_type = 'module';
}
else {
$extension_type = 'theme';
}
also, perhaps, we need to check the coincidence of names between different types. (see https://www.drupal.org/node/2732187)
Comments
Comment #1
Anonymous (not verified) CreditAttribution: Anonymous commentedvaplas created an issue. See original summary.
Comment #2
Anonymous (not verified) CreditAttribution: Anonymous commentedComment #3
Anonymous (not verified) CreditAttribution: Anonymous commentedComment #4
Anonymous (not verified) CreditAttribution: Anonymous commentedClose as duplicate of #2808063: LibraryDiscoveryParser::buildByExtension() doesn't validate that extensions exist