protected function LibraryDependencyResolver::doGetDependencies in Drupal 10
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Asset/LibraryDependencyResolver.php \Drupal\Core\Asset\LibraryDependencyResolver::doGetDependencies()
- 9 core/lib/Drupal/Core/Asset/LibraryDependencyResolver.php \Drupal\Core\Asset\LibraryDependencyResolver::doGetDependencies()
Gets the given libraries with its dependencies.
Helper method for ::getLibrariesWithDependencies().
Parameters
string[] $libraries_with_unresolved_dependencies: A list of libraries, with unresolved dependencies, in the order they should be loaded.
string[] $final_libraries: The final list of libraries (the return value) that is being built recursively.
Return value
string[] A list of libraries, in the order they should be loaded, including their dependencies.
File
- core/
lib/ Drupal/ Core/ Asset/ LibraryDependencyResolver.php, line 64
Class
- LibraryDependencyResolver
- Resolves the dependencies of asset (CSS/JavaScript) libraries.
Namespace
Drupal\Core\AssetCode
protected function doGetDependencies(array $libraries_with_unresolved_dependencies, array $final_libraries = []) {
foreach ($libraries_with_unresolved_dependencies as $library) {
if (!isset($final_libraries[$library])) {
[
$extension,
$name,
] = explode('/', $library, 2);
$definition = $this->libraryDiscovery
->getLibraryByName($extension, $name);
if (!empty($definition['dependencies'])) {
$final_libraries = $this
->doGetDependencies($definition['dependencies'], $final_libraries);
}
$final_libraries[$library] = $library;
}
}
return $final_libraries;
}