// not exist, then throw an exception.
$key_exists = NULL;
$parents =
array_merge($sub_key,
[$original]);
// Save the attributes of the library asset to be overridden.
$attributes = NestedArray::
getValue($library,
$parents,
$key_exists);
if ($key_exists) { // Remove asset to be overridden.
NestedArray::
unsetValue($library,
$parents);
// No need to replace if FALSE is specified, since that is a removal.
if ($replacement) { // Ensure the replacement path is relative to drupal root.
$replacement =
$this->
resolveThemeAssetPath($theme_path,
$replacement);
$new_parents =
array_merge($sub_key,
[$replacement]);
// Replace with an override if specified.
NestedArray::
setValue($library,
$new_parents,
$attributes);
} } } } /**
* Ensures that a full path is returned for an overriding theme asset.
*
* @param string $theme_path
* The theme or base theme.
* @param string $overriding_asset
* The overriding library asset.
*
* @return string
* A fully resolved theme asset path relative to the Drupal directory.
*/