You are here

function theme_filefield_paths_token_help in File (Field) Paths 5

Same name and namespace in other branches
  1. 6 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
Implementation of hook_form_alter().

File

./filefield_paths.module, line 33
Adds extra functionality to FileFields Path settings.

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;
    }
  }
  $output = theme('table', $headers, $rows, array(
    'class' => 'description',
  ));
  return $output;
}