function common_test_js_settings_alter

Same name in other branches
  1. 8.9.x core/modules/system/tests/modules/common_test/common_test.module \common_test_js_settings_alter()
  2. 10 core/modules/system/tests/modules/common_test/common_test.module \common_test_js_settings_alter()
  3. 11.x core/modules/system/tests/modules/common_test/common_test.module \common_test_js_settings_alter()

Implements hook_js_settings_alter().

See also

\Drupal\system\Tests\Common\JavaScriptTest::testHeaderSetting()

File

core/modules/system/tests/modules/common_test/common_test.module, line 272

Code

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