function common_test_library_info_alter

Same name and namespace in other branches
  1. 9 core/modules/system/tests/modules/common_test/common_test.module \common_test_library_info_alter()
  2. 8.9.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 165

Code

function common_test_library_info_alter(&$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.