LibraryDiscoveryParser
class LibraryDiscoveryParser (View source)
Parses library files to get extension data.
Properties
| protected ModuleHandlerInterface | $moduleHandler | The module handler. |
|
| protected ThemeManagerInterface | $themeManager | The theme manager. |
|
| protected string | $root | The app root. |
|
| protected StreamWrapperManagerInterface | $streamWrapperManager | The stream wrapper manager. |
|
| protected LibrariesDirectoryFileFinder | $librariesDirectoryFileFinder | The libraries directory file finder. |
|
| protected ExtensionPathResolver | $extensionPathResolver | The extension path resolver. |
Methods
Constructs a new LibraryDiscoveryParser instance.
Parses and builds up all the libraries information of an extension.
Parses a given library file and allows modules and themes to alter it.
Apply libraries overrides specified for the current active theme.
Determines if the supplied string is a valid URI.
Overrides the specified library asset.
Ensures that a full path is returned for an overriding theme asset.
Validates CSS library structure.
Details
__construct(string $root, ModuleHandlerInterface $module_handler, ThemeManagerInterface $theme_manager, StreamWrapperManagerInterface $stream_wrapper_manager, LibrariesDirectoryFileFinder $libraries_directory_file_finder = NULL, ExtensionPathResolver $extension_path_resolver = NULL)
Constructs a new LibraryDiscoveryParser instance.
array
buildByExtension(string $extension)
Parses and builds up all the libraries information of an extension.
protected array
parseLibraryInfo(string $extension, string $path)
Parses a given library file and allows modules and themes to alter it.
This method sets the parsed information onto the library property.
Library information is parsed from *.libraries.yml files; see editor.libraries.yml for an example. Every library must have at least one js or css entry. Each entry starts with a machine name and defines the following elements:
- js: A list of JavaScript files to include. Each file is keyed by the file path. An item can have several attributes (like HTML attributes). For example:
protected array
applyLibrariesOverride(array $libraries, string $extension)
Apply libraries overrides specified for the current active theme.
protected
drupalGetPath($type, $name)
deprecated
deprecated
Wraps drupal_get_path().
protected
isValidUri($string)
Determines if the supplied string is a valid URI.
protected
setOverrideValue(array $library, array $sub_key, array $overrides, string $theme_path)
Overrides the specified library asset.
protected string
resolveThemeAssetPath(string $theme_path, string $overriding_asset)
Ensures that a full path is returned for an overriding theme asset.
static int
validateCssLibrary(array $library)
Validates CSS library structure.