function locale_test_tokens

Same name in other branches
  1. 8.9.x core/modules/locale/tests/modules/locale_test/locale_test.module \locale_test_tokens()
  2. 10 core/modules/locale/tests/modules/locale_test/locale_test.module \locale_test_tokens()
  3. 11.x 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 199

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('Mooooh!');";
                    break;
                case 'security_test2':
                    $return[$original] = "<script>alert('Mooooh!');</script>";
                    break;
            }
        }
    }
    return $return;
}

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