You are here

function countries_token_info in Countries 8

Same name and namespace in other branches
  1. 7.2 countries.tokens.inc \countries_token_info()
  2. 7 countries.tokens.inc \countries_token_info()

Implements hook_token_info().

File

./countries.tokens.inc, line 11
Builds placeholder replacement tokens for country-related data.

Code

function countries_token_info() {
  $types['country'] = array(
    'name' => t('Countries'),
    'description' => t('Tokens related to individual countries.'),
    'needs-data' => 'country',
  );
  $types['default-country'] = array(
    'name' => t('Default country'),
    'description' => t('Tokens related to the sites default country.'),
    'type' => 'country',
  );
  $core_properties = countries_core_properties();
  $country['cid'] = array(
    'name' => t('Country ID'),
    'description' => t('The unique internal database ID of the country.'),
  );
  $country['name'] = array(
    'name' => $core_properties['name'],
    'description' => t('The name of the country.'),
  );
  $country['official-name'] = array(
    'name' => $core_properties['official_name'],
    'description' => t('The official name of the country.'),
  );
  $country['iso2'] = array(
    'name' => $core_properties['iso2'],
    'description' => t('The @property of the country.', array(
      '@property' => $core_properties['iso2'],
    )),
  );
  $country['iso3'] = array(
    'name' => $core_properties['iso3'],
    'description' => t('The @property of the country.', array(
      '@property' => $core_properties['iso3'],
    )),
  );
  $country['numcode'] = array(
    'name' => $core_properties['numcode'],
    'description' => t('The @property of the country.', array(
      '@property' => $core_properties['numcode'],
    )),
  );
  $country['continent'] = array(
    'name' => $core_properties['continent'],
    'description' => t('The @property of the country.', array(
      '@property' => $core_properties['continent'],
    )),
  );
  $country['continent-code'] = array(
    'name' => t('Continent code'),
    'description' => t('The Continent code of the country.'),
  );
  $country['enabled'] = array(
    'name' => $core_properties['enabled'],
    'description' => t('The @property of the country.', array(
      '@property' => $core_properties['continent'],
    )),
  );
  return array(
    'types' => $types,
    'tokens' => array(
      'country' => $country,
    ),
  );
}