You are here

function organigrams_token_info in Organigrams 7

Same name and namespace in other branches
  1. 8.2 organigrams.module \organigrams_token_info()
  2. 8 organigrams.module \organigrams_token_info()

Implements hook_token_info().

File

./organigrams.module, line 2009
Defines the organigrams functions and entity types.

Code

function organigrams_token_info() {

  // Define the token type 'organigrams'.
  $types['organigrams'] = array(
    'name' => t('Organigrams'),
    'description' => t('Tokens for inserting organigram blocks.'),
  );

  // Define an empty array.
  $organigrams = array();

  // Add tokens for all organigrams.
  foreach (organigrams_get_names() as $organigram) {
    $organigrams[$organigram->machine_name] = array(
      'name' => t('Organigram: !organigram', array(
        '!organigram' => $organigram->name,
      )),
      'description' => t('Insert the organigram !organigram.', array(
        '!organigram' => $organigram->name,
      )),
    );
  }
  return array(
    'types' => $types,
    'tokens' => array(
      'organigrams' => $organigrams,
    ),
  );
}