function common_test_library_info_alter

Same name in other branches
  1. 9 core/modules/system/tests/modules/common_test/common_test.module \common_test_library_info_alter()
  2. 10 core/modules/system/tests/modules/common_test/common_test.module \common_test_library_info_alter()
  3. 11.x core/modules/system/tests/modules/common_test/common_test.module \common_test_library_info_alter()

Implements hook_library_info_alter().

File

core/modules/system/tests/modules/common_test/common_test.module, line 172

Code

function common_test_library_info_alter(&$libraries, $module) {
    if ($module == 'core' && isset($libraries['jquery.farbtastic'])) {
        // Change the version of Farbtastic to 0.0.
        $libraries['jquery.farbtastic']['version'] = '0.0';
        // Make Farbtastic depend on jQuery Form to test library dependencies.
        $libraries['jquery.farbtastic']['dependencies'][] = 'core/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.