function CommonTestHooks::jsSettingsAlter
Implements hook_js_settings_alter().
See also
\Drupal\system\Tests\Common\JavaScriptTest::testHeaderSetting()
File
-
core/
modules/ system/ tests/ modules/ common_test/ src/ Hook/ CommonTestHooks.php, line 187
Class
- CommonTestHooks
- Hook implementations for common_test.
Namespace
Drupal\common_test\HookCode
public function jsSettingsAlter(&$settings, AttachedAssetsInterface $assets) {
// Modify an existing setting.
if (array_key_exists('pluralDelimiter', $settings)) {
$settings['pluralDelimiter'] = '☃';
}
// Add a setting.
$settings['foo'] = 'bar';
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.