1 taxonomy.tokens.inc | taxonomy_token_info() |
Implements hook_token_info().
File
- core/
modules/ taxonomy/ taxonomy.tokens.inc, line 10 - Builds placeholder replacement tokens for taxonomy terms and vocabularies.
Code
function taxonomy_token_info() {
$types['term'] = array(
'name' => t('Taxonomy terms'),
'description' => t('Tokens related to taxonomy terms.'),
'needs-data' => 'term',
);
$types['vocabulary'] = array(
'name' => t('Vocabularies'),
'description' => t('Tokens related to taxonomy vocabularies.'),
'needs-data' => 'vocabulary',
);
// Taxonomy term related variables.
$term['tid'] = array(
'name' => t('Term ID'),
'description' => t('The unique ID of the taxonomy term.'),
);
$term['name'] = array(
'name' => t('Name'),
'description' => t('The name of the taxonomy term.'),
);
$term['description'] = array(
'name' => t('Description'),
'description' => t('The optional description of the taxonomy term.'),
);
$term['node-count'] = array(
'name' => t('Node count'),
'description' => t('The number of nodes tagged with the taxonomy term.'),
);
$term['langcode'] = array(
'name' => t('Language code'),
'description' => t('The language code of the language the term is written in.'),
);
$term['url'] = array(
'name' => t('URL'),
'description' => t('The URL of the taxonomy term.'),
'type' => 'url',
);
$term['edit-url'] = array(
'name' => t('Edit URL'),
'description' => t("The URL of the taxonomy term's edit page."),
'type' => 'url',
);
$term['parents'] = array(
'name' => t('Parents'),
'description' => t("An array of all the term's parents, starting with the root."),
'type' => 'array',
);
$term['parent'] = array(
'name' => t('Parent term'),
'description' => t('The parent term of the taxonomy term, if one exists. If more than one parent exists, the first parent.'),
'type' => 'term',
);
$term['root'] = array(
'name' => t('Root term'),
'description' => t('The root term of the taxonomy term.'),
'type' => 'term',
);
$term['vocabulary'] = array(
'name' => t('Vocabulary'),
'description' => t('The vocabulary the taxonomy term belongs to.'),
'type' => 'vocabulary',
);
// Taxonomy vocabulary related variables.
$vocabulary['name'] = array(
'name' => t('Name'),
'description' => t('The human-readable name of the taxonomy vocabulary.'),
);
$vocabulary['machine-name'] = array(
'name' => t('Machine-readable name'),
'description' => t('The unique machine-readable name of the vocabulary.'),
);
$vocabulary['description'] = array(
'name' => t('Description'),
'description' => t('The optional description of the taxonomy vocabulary.'),
);
$vocabulary['node-count'] = array(
'name' => t('Node count'),
'description' => t('The number of nodes tagged with terms belonging to the taxonomy vocabulary.'),
);
$vocabulary['term-count'] = array(
'name' => t('Term count'),
'description' => t('The number of terms belonging to the taxonomy vocabulary.'),
);
$vocabulary['edit-url'] = array(
'name' => t('Edit URL'),
'description' => t("The URL of the vocabulary's edit page."),
'type' => 'url',
);
return array(
'types' => $types,
'tokens' => array(
'term' => $term,
'vocabulary' => $vocabulary,
),
);
}