protected function StableLibraryOverrideTest::removeVendorAssets in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/system/src/Tests/Theme/StableLibraryOverrideTest.php \Drupal\system\Tests\Theme\StableLibraryOverrideTest::removeVendorAssets()
Removes all vendor libraries and assets from the library definitions.
Parameters
array[] $all_libraries: An associative array of libraries keyed by extension, then by library name, and so on.
Return value
array[] The reduced array of libraries.
1 call to StableLibraryOverrideTest::removeVendorAssets()
- StableLibraryOverrideTest::testStableLibraryOverrides in core/
modules/ system/ src/ Tests/ Theme/ StableLibraryOverrideTest.php - Ensures that Stable overrides all relevant core library assets.
File
- core/
modules/ system/ src/ Tests/ Theme/ StableLibraryOverrideTest.php, line 137 - Contains \Drupal\system\Tests\Theme\StableLibraryOverrideTest.
Class
- StableLibraryOverrideTest
- Tests Stable's library overrides.
Namespace
Drupal\system\Tests\ThemeCode
protected function removeVendorAssets($all_libraries) {
foreach ($all_libraries as $extension => $libraries) {
foreach ($libraries as $library_name => $library) {
if (isset($library['remote'])) {
unset($all_libraries[$extension][$library_name]);
}
foreach ([
'css',
'js',
] as $asset_type) {
foreach ($library[$asset_type] as $index => $asset) {
if (strpos($asset['data'], 'core/assets/vendor') !== FALSE) {
unset($all_libraries[$extension][$library_name][$asset_type][$index]);
// Re-key the array of assets. This is needed because
// libraries-override doesn't always preserve the order.
if (!empty($all_libraries[$extension][$library_name][$asset_type])) {
$all_libraries[$extension][$library_name][$asset_type] = array_values($all_libraries[$extension][$library_name][$asset_type]);
}
}
}
}
}
}
return $all_libraries;
}