AssetResolver::getLibrariesToLoad
protected function AssetResolver::getLibrariesToLoad
protected AssetResolver::getLibrariesToLoad(AttachedAssetsInterface $assets)
Returns the libraries that need to be loaded.
For example, with core/a depending on core/c and core/b on core/d:
$assets = new AttachedAssets(); $assets->setLibraries(['core/a', 'core/b', 'core/c']); $assets->setAlreadyLoadedLibraries(['core/c']); $resolver->getLibrariesToLoad($assets) === ['core/a', 'core/b', 'core/d']
Parameters
\Drupal\Core\Asset\AttachedAssetsInterface $assets: The assets attached to the current response.
Return value
string[] A list of libraries and their dependencies, in the order they should be loaded, excluding any libraries that have already been loaded.
File
- core/lib/Drupal/Core/Asset/AssetResolver.php, line 102
Class
- AssetResolver
- The default asset resolver.
Namespace
Drupal\Core\AssetCode
protected function getLibrariesToLoad(AttachedAssetsInterface $assets) { return array_diff( $this->libraryDependencyResolver->getLibrariesWithDependencies($assets->getLibraries()), $this->libraryDependencyResolver->getLibrariesWithDependencies($assets->getAlreadyLoadedLibraries()) ); }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Asset!AssetResolver.php/function/AssetResolver::getLibrariesToLoad/8.1.x