function locale_test_tokens in Drupal 9
Same name and namespace in other branches
- 8 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 - Simulate a custom module with a local po file.
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;
}