You are here

function _token_token_tree_format_row in Token 6

Same name and namespace in other branches
  1. 7 token.pages.inc \_token_token_tree_format_row()

Build a row in the token tree.

1 call to _token_token_tree_format_row()
theme_token_tree in ./token.pages.inc
Provide a 'tree' display of nested tokens.

File

./token.pages.inc, line 115
User page callbacks for the token module.

Code

function _token_token_tree_format_row($token, $token_info = array(), $is_group = FALSE) {
  $row = array(
    'id' => _token_clean_css_identifier($token),
    'class' => array(),
    'data' => array(
      'token' => '',
      'description' => !empty($token_info['description']) ? $token_info['description'] : '',
    ),
  );
  if ($is_group) {

    // This is a token type/group.
    $row['data']['token'] = drupal_ucfirst($token);
    $row['class'][] = 'token-group';
    $row['id'] .= '-group';
  }
  else {

    // This is a token.
    $row['data']['token'] = array(
      'data' => $token,
      'class' => 'token-key',
    );
    if (!empty($token_info['parent'])) {
      $row['class'][] = 'child-of-' . _token_clean_css_identifier($token_info['parent']) . '-group';
    }
  }
  $row['class'] = implode(' ', $row['class']);
  return $row;
}