token_insert.inc in Token Insert 6.2
Same filename and directory in other branches
wysiwyg plugin hook.
File
token_insert.incView source
<?php
// $Id$
/**
* @file
* wysiwyg plugin hook.
*/
function token_insert_get_tokens() {
global $user;
$roles['global'] = 'global';
if (variable_get('token_insert_use_tokens_per_role', 0)) {
$roles += $user->roles;
}
$all_tokens = token_get_list();
foreach ($roles as $rid => $role) {
foreach ($all_tokens as $category => $tokens) {
$category_safe = str_replace(' ', '_', $category);
$allowed_options = variable_get('token_insert_' . $rid . '_used_tokens_' . $category_safe, array());
foreach ($tokens as $token => $description) {
if ($allowed_options[$token] === $token) {
$options['token ' . $category . ' ' . $token] = $category . ' : [' . $token . '] : ' . truncate_utf8($description, 60, TRUE, TRUE);
}
else {
$all_options['token ' . $category . ' ' . $token] = $category . ' : [' . $token . '] : ' . truncate_utf8($description, 60, TRUE, TRUE);
}
}
}
}
if (empty($options)) {
$options = $all_options;
}
return $options;
}
Functions
Name | Description |
---|---|
token_insert_get_tokens | @file wysiwyg plugin hook. |