You are here

function file_entity_token_info in File Entity (fieldable files) 7

Same name and namespace in other branches
  1. 8.2 file_entity.tokens.inc \file_entity_token_info()
  2. 7.3 file_entity.tokens.inc \file_entity_token_info()
  3. 7.2 file_entity.tokens.inc \file_entity_token_info()

Implements hook_token_info().

File

./file_entity.tokens.inc, line 11
Token integration for the file_entity module.

Code

function file_entity_token_info() {

  // File type tokens.
  $info['types']['file-type'] = array(
    'name' => t('File type'),
    'description' => t('Tokens associated with file types.'),
    'needs-data' => 'file_type',
  );
  $info['tokens']['file-type']['name'] = array(
    'name' => t('Name'),
    'description' => t('The name of the file type.'),
  );
  $info['tokens']['file-type']['machine-name'] = array(
    'name' => t('Machine-readable name'),
    'description' => t('The unique machine-readable name of the file type.'),
  );
  $info['tokens']['file-type']['count'] = array(
    'name' => t('File count'),
    'description' => t('The number of files belonging to the file type.'),
  );
  $info['tokens']['file-type']['edit-url'] = array(
    'name' => t('Edit URL'),
    'description' => t("The URL of the file type's edit page."),
  );

  // File tokens.
  $info['tokens']['file']['type'] = array(
    'name' => t('File type'),
    'description' => t('The file type of the file.'),
    'type' => 'file-type',
  );
  return $info;
}