You are here

function theme_filefield_paths_token_help in File (Field) Paths 6

Same name and namespace in other branches
  1. 5 filefield_paths.module \theme_filefield_paths_token_help()
1 theme call to theme_filefield_paths_token_help()
filefield_paths_form_alter in ./filefield_paths.module
Implements hook_form_alter().

File

./filefield_paths.module, line 27
Contains core functions for the FileField Paths module.

Code

function theme_filefield_paths_token_help($prefix = '[', $suffix = ']') {
  token_include();
  $full_list = array_merge(filefield_paths_token_list(), token_get_list('node'));
  if (function_exists('filefield_token_list')) {
    $temp_tokens = filefield_token_list();
    $full_list['file'] = array_merge($temp_tokens['file'], $full_list['file']);
  }
  $headers = array(
    t('Token'),
    t('Replacement value'),
  );
  $rows = array();
  foreach ($full_list as $key => $category) {
    $rows[] = array(
      array(
        'data' => drupal_ucfirst($key) . ' ' . t('tokens'),
        'class' => 'region',
        'colspan' => 2,
      ),
    );
    foreach ($category as $token => $description) {
      $row = array();
      $row[] = $prefix . $token . $suffix;
      $row[] = $description;
      $rows[] = $row;
    }
  }
  return theme('table', $headers, $rows, array(
    'class' => 'description',
  ));
}