AssetResolverInterface::getCssAssets

public AssetResolverInterface::getCssAssets(AttachedAssetsInterface $assets, $optimize) Returns the CSS assets for the current response's libraries. It returns the CSS assets in order, according to the SMACSS categories specified in the assets' weights: CSS_BASE CSS_LAYOUT CSS_COMPONENT CSS_STATE CSS_THEME This ensures proper cascading of styles so themes can easily override module styles through CSS selectors. Themes may replace module-defined CSS files by adding a stylesheet with the same f

AttachedAssets

The default attached assets collection. Hierarchy class \Drupal\Core\Asset\AttachedAssets implements AttachedAssetsInterface File core/lib/Drupal/Core/Asset/AttachedAssets.php, line 8 Namespace Drupal\Core\Asset Members Name Modifiers Type Description AttachedAssets::$alreadyLoadedLibraries protected property The set of asset libraries that the client has already loaded. AttachedAssets::$libraries public property The (ordered) list of asset libraries attached to

AttachedAssets::$alreadyLoadedLibraries

The set of asset libraries that the client has already loaded. Type: string[] File core/lib/Drupal/Core/Asset/AttachedAssets.php, line 29 Class AttachedAssets The default attached assets collection. Namespace Drupal\Core\Asset Code protected $alreadyLoadedLibraries = [];

AssetResolverInterface::getJsAssets

public AssetResolverInterface::getJsAssets(AttachedAssetsInterface $assets, $optimize) Returns the JavaScript assets for the current response's libraries. References to JavaScript files are placed in a certain order: first, all 'core' files, then all 'module' and finally all 'theme' JavaScript files are added to the page. Then, all settings are output, followed by 'inline' JavaScript code. If running update.php, all preprocessing is disabled. Note that hook_js_alter(&$javascript) is called

AssetResolver::sort

public static AssetResolver::sort($a, $b) Sorts CSS and JavaScript resources. This sort order helps optimize front-end performance while providing modules and themes with the necessary control for ordering the CSS and JavaScript appearing on a page. Parameters $a: First item for comparison. The compared items should be associative arrays of member items. $b: Second item for comparison. Return value int File core/lib/Drupal/Core/Asset/AssetResolver.php, line 371 Class AssetResolver The de

AssetResolver::getJsSettingsAssets

protected AssetResolver::getJsSettingsAssets(AttachedAssetsInterface $assets) Returns the JavaScript settings assets for this response's libraries. Gathers all drupalSettings from all libraries in the attached assets collection and merges them. Parameters \Drupal\Core\Asset\AttachedAssetsInterface $assets: The assets attached to the current response. Return value array A (possibly optimized) collection of JavaScript assets. File core/lib/Drupal/Core/Asset/AssetResolver.php, line 194 Class

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

AssetResolverInterface

Resolves asset libraries into concrete CSS and JavaScript assets. Given an attached assets collection (to be loaded for the current response), the asset resolver can resolve those asset libraries into a list of concrete CSS and JavaScript assets. In other words: this allows developers to translate Drupal's asset abstraction (asset libraries) into concrete assets. Hierarchy interface \Drupal\Core\Asset\AssetResolverInterface See also \Drupal\Core\Asset\AttachedAssetsInterface \Drupal\Core\As

AssetResolver::getJsAssets

public AssetResolver::getJsAssets(AttachedAssetsInterface $assets, $optimize) Returns the JavaScript assets for the current response's libraries. References to JavaScript files are placed in a certain order: first, all 'core' files, then all 'module' and finally all 'theme' JavaScript files are added to the page. Then, all settings are output, followed by 'inline' JavaScript code. If running update.php, all preprocessing is disabled. Note that hook_js_alter(&$javascript) is called during th

AssetResolver::__construct

public AssetResolver::__construct(LibraryDiscoveryInterface $library_discovery, LibraryDependencyResolverInterface $library_dependency_resolver, ModuleHandlerInterface $module_handler, ThemeManagerInterface $theme_manager, LanguageManagerInterface $language_manager, CacheBackendInterface $cache) Constructs a new AssetResolver instance. Parameters \Drupal\Core\Asset\LibraryDiscoveryInterface $library_discovery: The library discovery service. \Drupal\Core\Asset\LibraryDependencyResolverInterface