You are here

function common_test_js_alter in Drupal 10

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

Implements hook_js_alter().

See also

\Drupal\KernelTests\Core\Asset\AttachedAssetsTest::testAlter()

File

core/modules/system/tests/modules/common_test/common_test.module, line 253
Helper module for the Common tests.

Code

function common_test_js_alter(&$javascript, AttachedAssetsInterface $assets) {

  // Attach alter.js above tableselect.js.
  $alterjs = \Drupal::service('extension.list.module')
    ->getPath('common_test') . '/alter.js';
  if (array_key_exists($alterjs, $javascript) && array_key_exists('core/misc/tableselect.js', $javascript)) {
    $javascript[$alterjs]['weight'] = $javascript['core/misc/tableselect.js']['weight'] - 1;
  }
}