You are here

protected function LibraryDependencyResolver::doGetDependencies in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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 55
Contains \Drupal\Core\Asset\LibraryDependencyResolver.

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 (!in_array($library, $final_libraries)) {
      list($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;
    }
  }
  return $final_libraries;
}