function realname_tokens in Real Name 7
Implements hook_tokens().
File
- ./
realname.tokens.inc, line 33 - Builds placeholder replacement tokens for realname.
Code
function realname_tokens($type, $tokens, array $data = array(), array $options = array()) {
$replacements = array();
$sanitize = !empty($options['sanitize']);
if ($type == 'user' && !empty($data['user'])) {
$account = $data['user'];
foreach ($tokens as $name => $original) {
switch ($name) {
case 'name-raw':
$replacements[$original] = $sanitize ? check_plain($account->name) : $account->name;
break;
}
}
}
return $replacements;
}