You are here

function filefield_paths_token_list in File (Field) Paths 6.2

Same name and namespace in other branches
  1. 5 filefield_paths.module \filefield_paths_token_list()
  2. 6 filefield_paths.module \filefield_paths_token_list()

Implements hook_token_list().

File

modules/token.inc, line 10
Token module integration.

Code

function filefield_paths_token_list($type = 'all') {
  if ($type == 'field' || $type == 'filefield_paths' || $type == 'all') {
    $tokens = array();
    if (!module_exists('filefield')) {
      $tokens['file']['filefield-onlyname'] = t("File name without extension");
      $tokens['file']['filefield-extension'] = t("File extension");
    }
    $tokens['file']['filefield-onlyname-original'] = t("File name without extension - original");
    $tokens['file']['filefield-extension-original'] = t("File extension - original");

    // Invoke hook_filefield_paths_tokens().
    foreach (module_implements('filefield_paths_field_tokens') as $module) {
      $function = "{$module}_token_list";
      $tokens = array_merge_recursive($function('field'), $tokens);
    }
    return $tokens;
  }
}