function organigrams_token_info in Organigrams 8.2
Same name and namespace in other branches
- 8 organigrams.module \organigrams_token_info()
- 7 organigrams.module \organigrams_token_info()
Implements hook_token_info().
Add organigrams as tokens.
File
- ./
organigrams.module, line 202 - Extends Taxonomy to create organigrams.
Code
function organigrams_token_info() {
$info = [];
// Create new token type.
$info['types']['organigrams'] = [
'name' => t('Organigrams'),
'description' => t('Token related to organigrams.'),
];
// Get all vocabularies and iterate through them.
$vocabularies = \Drupal::entityTypeManager()
->getStorage('taxonomy_vocabulary')
->loadMultiple();
foreach ($vocabularies as $id => $vocabulary) {
// Create a token for each vocabulary.
$info['tokens']['organigrams'][$id] = [
'name' => $vocabulary
->label(),
'description' => t('Display the organigram :organigram', [
':organigram' => $vocabulary
->label(),
]),
];
}
return $info;
}