1 system.theme.inc | theme_token_tree_link($variables) |
Theme a link to a token tree either as a regular link or a dialog.
File
- core/
modules/ system/ system.theme.inc, line 576 - Theme functions for the System module.
Code
function theme_token_tree_link($variables) {
$options = array(
'attributes' => array(),
'query' => array(
'token' => backdrop_get_token('token-browser'),
'show_restricted' => $variables['show_restricted'] ? 1 : 0,
),
);
if (!empty($variables['token_types'])) {
$options['query']['token_types'] = backdrop_json_encode($variables['token_types']);
$options['query']['global_types'] = backdrop_json_encode($variables['global_types']);
}
if (!empty($variables['dialog'])) {
backdrop_add_library('system', 'token');
backdrop_add_library('system', 'backdrop.ajax');
$options['attributes']['class'][] = 'use-ajax token-browser-link';
}
else {
$options['attributes']['target'] = '_blank';
}
// Create a security token.
$settings['tokenBrowser'] = array(
'token' => backdrop_get_token('token-browser-endpoint'),
'restricted' => $variables['show_restricted'],
'click_insert' => $variables['click_insert'],
);
backdrop_add_js($settings, 'setting');
return l($variables['text'], 'token/tree', $options);
}