function CommonTestHooks::jsAlter
Implements hook_js_alter().
See also
\Drupal\KernelTests\Core\Asset\AttachedAssetsTest::testAlter()
File
-
core/
modules/ system/ tests/ modules/ common_test/ src/ Hook/ CommonTestHooks.php, line 173
Class
- CommonTestHooks
- Hook implementations for common_test.
Namespace
Drupal\common_test\HookCode
public function jsAlter(&$javascript, AttachedAssetsInterface $assets, LanguageInterface $language) {
// Attach alter.js above tableselect.js.
$alter_js = \Drupal::service('extension.list.module')->getPath('common_test') . '/alter.js';
if (array_key_exists($alter_js, $javascript) && array_key_exists('core/misc/tableselect.js', $javascript)) {
$javascript[$alter_js]['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.