function theme_test_library_info_alter

Same name and namespace in other branches
  1. 9 core/modules/system/tests/modules/theme_test/theme_test.module \theme_test_library_info_alter()

Implements hook_library_info_alter().

File

core/modules/system/tests/modules/theme_test/theme_test.module, line 219

Code

function theme_test_library_info_alter(array &$libraries, string $extension) : void {
  // Allow test code to simulate library changes in a particular extension by
  // setting a state key in the form `theme_test_library_info_alter $extension`,
  // whose values is an array containing everything that should be recursively
  // merged into the given extension's library definitions.
  $info = \Drupal::state()->get(__FUNCTION__ . " {$extension}");
  if (is_array($info)) {
    $libraries = NestedArray::mergeDeep($libraries, $info);
  }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.