function CommonTestHooks::libraryInfoAlter

Implements hook_library_info_alter().

File

core/modules/system/tests/modules/common_test/src/Hook/CommonTestHooks.php, line 94

Class

CommonTestHooks
Hook implementations for common_test.

Namespace

Drupal\common_test\Hook

Code

public function libraryInfoAlter(&$libraries, $module) {
    if ($module === 'core' && isset($libraries['loadjs'])) {
        // Change the version of loadjs to 0.0.
        $libraries['loadjs']['version'] = '0.0';
        // Make loadjs depend on jQuery Form to test library dependencies.
        $libraries['loadjs']['dependencies'][] = 'core/internal.jquery.form';
    }
    // Alter the dynamically registered library definition.
    if ($module === 'common_test' && isset($libraries['dynamic_library'])) {
        $libraries['dynamic_library']['dependencies'] = [
            'core/jquery',
        ];
    }
}

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