function theme_activity_token_help in Activity 6.2
This is a replacement for Token's theme_token_help().
This is a duplicate of the Token's function, but with a small modification: the $type parameter is now $types, allowing for listing tokens from several categories.
1 theme call to theme_activity_token_help()
- _activity_settings_form_messages in ./
activity.admin.inc - Show the text boxes according to the _triggers and _ops steps.
File
- ./
activity.module, line 1002 - Primarily Drupal hooks and global API functions to manipulate activity.
Code
function theme_activity_token_help($types = array(
'all',
), $prefix = '[', $suffix = ']') {
token_include();
if (in_array('account', $types)) {
// so we bring in the user tokens as well
$types[] = 'user';
}
// Sometimes we need access to multiple objects. In the case of a comment, for
// example, we need the comment, node, and user objects in order to be able to
// do enough tokenizing. Idea appropriated from http://drupal.org/node/306324
if (in_array('comment', $types)) {
$types[] = 'node';
}
if (in_array('node', $types)) {
$types[] = 'user';
}
$tokens = activity_token_get_list($types);
$headers = array(
t('Token'),
t('Replacement value'),
);
foreach ($tokens as $key => $category) {
$rows = array();
//$rows[] = array(array('data' => drupal_ucfirst($key) . ' ' . t('tokens'), 'class' => 'region', 'colspan' => 2));
$form[$key] = array(
'#type' => 'fieldset',
'#title' => drupal_ucfirst($key),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
foreach ($category as $token => $description) {
$row = array();
$row[] = $prefix . $token . $suffix;
$row[] = $description;
$rows[] = $row;
}
$form[$key]['tokens'] = array(
'#type' => 'markup',
'#value' => theme('table', $headers, $rows, array(
'class' => 'description',
)),
);
}
return drupal_render($form);
}