You are here

function countries_field_formatter_info in Countries 7

Same name and namespace in other branches
  1. 8 countries.fields.inc \countries_field_formatter_info()
  2. 7.2 countries.fields.inc \countries_field_formatter_info()

Implements hook_field_formatter_info().

File

./countries.module, line 384

Code

function countries_field_formatter_info() {
  $formatters = array(
    'country_default' => array(
      'label' => t('Default'),
      'field types' => array(
        'country',
      ),
    ),
    'country_official' => array(
      'label' => t('Official name'),
      'field types' => array(
        'country',
      ),
    ),
    'country_alpha_2' => array(
      'label' => t('ISO alpha-2 code'),
      'field types' => array(
        'country',
      ),
    ),
    'country_alpha_3' => array(
      'label' => t('ISO alpha-3 code'),
      'field types' => array(
        'country',
      ),
    ),
    'country_number' => array(
      'label' => t('ISO numeric-3 code'),
      'field types' => array(
        'country',
      ),
    ),
  );

  // Third party module integration. Use "country_{$module}_data1_data2" format.
  if (module_exists('countryicons')) {
    foreach (countryicons_get_iconsets() as $iconsets) {
      $formatter = implode('_', array(
        'country',
        'countryicons',
        'image',
        $iconsets['name'],
      ));
      $formatters[$formatter] = array(
        'label' => t('Country icon image ' . $iconsets['name']),
        'field types' => array(
          'country',
        ),
      );
      $formatter = implode('_', array(
        'country',
        'countryicons',
        'sprite',
        $iconsets['name'],
      ));
      $formatters[$formatter] = array(
        'label' => t('Country icon sprite ' . $iconsets['name']),
        'field types' => array(
          'country',
        ),
      );
    }
  }
  return $formatters;
}