function ThemeTestHooks::libraryInfoAlter

Implements hook_library_info_alter().

File

core/modules/system/tests/modules/theme_test/src/Hook/ThemeTestHooks.php, line 108

Class

ThemeTestHooks
Hook implementations for theme_test.

Namespace

Drupal\theme_test\Hook

Code

public function libraryInfoAlter(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('theme_test_library_info_alter' . " {$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.