function LibraryDependencyResolver::doGetDependencies

Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/Asset/LibraryDependencyResolver.php \Drupal\Core\Asset\LibraryDependencyResolver::doGetDependencies()
  2. 10 core/lib/Drupal/Core/Asset/LibraryDependencyResolver.php \Drupal\Core\Asset\LibraryDependencyResolver::doGetDependencies()
  3. 11.x 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.

1 call to LibraryDependencyResolver::doGetDependencies()
LibraryDependencyResolver::getLibrariesWithDependencies in core/lib/Drupal/Core/Asset/LibraryDependencyResolver.php
Gets the given libraries with 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\Asset

Code

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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.