function theme_token_tree

×

Error message

User warning: The following module is missing from the file system: theme/theme. For information about how to fix this, see the documentation page. in _drupal_trigger_error_with_delayed_logging() (line 1156 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
cis7 token.pages.inc theme_token_tree($variables)
cle7 token.pages.inc theme_token_tree($variables)
elmsmedia7 token.pages.inc theme_token_tree($variables)
icor7 token.pages.inc theme_token_tree($variables)
meedjum_blog7 token.pages.inc theme_token_tree($variables)
mooc7 token.pages.inc theme_token_tree($variables)

Provide a 'tree' display of nested tokens.

Related topics

3 theme calls to theme_token_tree()
filefield_paths_form_alter in sites/all/modules/ulmus/filefield_paths/filefield_paths.module
Implements hook_form_alter().
token_help in sites/all/modules/ulmus/token/token.module
Implements hook_help().
token_page_output_tree in sites/all/modules/ulmus/token/token.pages.inc
Page callback to output a token tree as an empty page.
22 string references to the theme hook from theme_token_tree()

Note: this list is generated by looking for the string for this theme hook, so it may include some references that are not actually using this theme hook.

auto_nodetitle_form_node_type_form_alter in sites/all/modules/ulmus/auto_nodetitle/auto_nodetitle.module
Implements hook_form_FORM_ID_alter() for the node type form.
better_exposed_filters_exposed_form_plugin::options_form in sites/all/modules/ulmus/better_exposed_filters/better_exposed_filters_exposed_form_plugin.inc
Provide a form to edit options for this plugin.
ds_edit_custom_field_form in sites/all/modules/ulmus/ds/modules/ds_ui/includes/ds.fields.inc
Manage a custom field.
eva_plugin_display_entity::options_form in sites/all/modules/ulmus/eva/eva_plugin_display_entity.inc
Provide the default form for setting options.
filefield_paths_form_alter in sites/all/modules/ulmus/filefield_paths/filefield_paths.module
Implements hook_form_alter().

... See full list

File

sites/all/modules/ulmus/token/token.pages.inc, line 91
User page callbacks for the token module.

Code

function theme_token_tree($variables) {
  if (!empty($variables['dialog'])) {
    return theme_token_tree_link($variables);
  }

  $token_types = $variables['token_types'];
  $info = token_get_info();

  if ($token_types == 'all') {
    $token_types = array_keys($info['types']);
  }
  elseif ($variables['global_types']) {
    $token_types = array_merge($token_types, token_get_global_token_types());
  }

  $element = array(
    '#cache' => array(
      'cid' => 'tree-rendered:' . hash('sha256', serialize(array('token_types' => $token_types, 'global_types' => NULL) + $variables)),
      'bin' => 'cache_token',
    ),
  );
  if ($cached_output = token_render_cache_get($element)) {
    return $cached_output;
  }

  $options = array(
    'flat' => TRUE,
    'restricted' => $variables['show_restricted'],
    'depth' => $variables['recursion_limit'],
  );
  $multiple_token_types = (count($token_types) > 1);
  $rows = array();

  foreach ($info['types'] as $type => $type_info) {
    if (!in_array($type, $token_types)) {
      continue;
    }

    if ($multiple_token_types) {
      $row = _token_token_tree_format_row($type, $type_info, TRUE);
      unset($row['data']['value']);
      $rows[] = $row;
    }

    $tree = token_build_tree($type, $options);
    foreach ($tree as $token => $token_info) {
      if (!empty($token_info['restricted']) && empty($variables['show_restricted'])) {
        continue;
      }
      if ($multiple_token_types && !isset($token_info['parent'])) {
        $token_info['parent'] = $type;
      }
      $row = _token_token_tree_format_row($token, $token_info);
      unset($row['data']['value']);
      $rows[] = $row;
    }
  }

  $element += array(
    '#theme' => 'tree_table',
    '#header' => array(
      t('Name'),
      t('Token'),
      t('Description'),
    ),
    '#rows' => $rows,
    '#attributes' => array('class' => array('token-tree')),
    '#empty' => t('No tokens available'),
    '#attached' => array(
      'js' => array(drupal_get_path('module', 'token') . '/token.js'),
      'css' => array(drupal_get_path('module', 'token') . '/token.css'),
      'library' => array(array('token', 'treeTable')),
    ),
  );

  if ($variables['click_insert']) {
    $element['#caption'] = t('Click a token to insert it into the field you\'ve last clicked.');
    $element['#attributes']['class'][] = 'token-click-insert';
  }

  $output = drupal_render($element);
  token_render_cache_set($output, $element);
  return $output;
}