public static function LibraryDiscoveryParser::validateCssLibrary in Drupal 8
Same name and namespace in other branches
- 9 core/lib/Drupal/Core/Asset/LibraryDiscoveryParser.php \Drupal\Core\Asset\LibraryDiscoveryParser::validateCssLibrary()
- 10 core/lib/Drupal/Core/Asset/LibraryDiscoveryParser.php \Drupal\Core\Asset\LibraryDiscoveryParser::validateCssLibrary()
Validates CSS library structure.
Parameters
array $library: The library definition array.
Return value
int Returns based on validity:
- 0 if the library definition is valid
- 1 if the library definition has improper nesting
- 2 if the library definition specifies files as an array
1 call to LibraryDiscoveryParser::validateCssLibrary()
- LibraryDiscoveryParser::buildByExtension in core/
lib/ Drupal/ Core/ Asset/ LibraryDiscoveryParser.php - Parses and builds up all the libraries information of an extension.
File
- core/
lib/ Drupal/ Core/ Asset/ LibraryDiscoveryParser.php, line 527
Class
- LibraryDiscoveryParser
- Parses library files to get extension data.
Namespace
Drupal\Core\AssetCode
public static function validateCssLibrary($library) {
$categories = [];
// Verify options first and return early if invalid.
foreach ($library as $category => $files) {
if (!is_array($files)) {
return 2;
}
$categories[] = $category;
foreach ($files as $source => $options) {
if (!is_array($options)) {
return 1;
}
}
}
return 0;
}