function locale_test_tokens

Same name in other branches
  1. 9 core/modules/locale/tests/modules/locale_test/locale_test.module \locale_test_tokens()
  2. 8.9.x core/modules/locale/tests/modules/locale_test/locale_test.module \locale_test_tokens()
  3. 10 core/modules/locale/tests/modules/locale_test/locale_test.module \locale_test_tokens()

Implements hook_tokens().

File

core/modules/locale/tests/modules/locale_test/locale_test.module, line 201

Code

function locale_test_tokens($type, $tokens, array $data = [], array $options = []) {
    $return = [];
    if ($type == 'locale_test') {
        foreach ($tokens as $name => $original) {
            switch ($name) {
                case 'security_test1':
                    $return[$original] = "javascript:alert('Hello!');";
                    break;
                case 'security_test2':
                    $return[$original] = "<script>alert('Hello!');</script>";
                    break;
            }
        }
    }
    return $return;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.