function 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 259 
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;
  }
}Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.
