Problem/Motivation
We currently have this in our LibraryDiscoveryParser class:
if ($extension === 'core') {
$path = 'core';
$extension_type = 'core';
}
else {
if ($this->moduleHandler->moduleExists($extension)) {
$extension_type = 'module';
}
else {
$extension_type = 'theme';
}
$path = $this->drupalGetPath($extension_type, $extension);
}
This was only meant as a temporary 'hack' with the plan to remove this in favour of getting this from a parameter instead.
Proposed resolution
Either:
1. Pass the $type into LibraryDiscoveryInterface::getLibrariesByExtension/getLibraryByName
2. Pass an Extension object around instead, as this hold the extension type ($extension->getType())
3. Determine the extension type another way?
Remaining tasks
Discuss, decide, patch, tests.
User interface changes
None
API changes
None