You are here

function telephone_formatter_field_formatter_settings_form in Telephone Formatter 7

Implements hook_field_formatter_settings_form().

File

./telephone_formatter.module, line 26

Code

function telephone_formatter_field_formatter_settings_form($field, $instance, $view_mode, $form, &$form_state) {
  $display = $instance['display'][$view_mode];
  $settings = $display['settings'];
  $elements['format'] = array(
    '#type' => 'select',
    '#title' => t('Format'),
    '#description' => t('List of available formats'),
    '#default_value' => $settings['format'],
    '#options' => _telephone_formatter_get_available_formats(),
  );
  $elements['link'] = array(
    '#type' => 'checkbox',
    '#title' => t('Link'),
    '#description' => t('Format as link'),
    '#default_value' => $settings['link'],
  );
  $elements['default_country'] = array(
    '#type' => 'select',
    '#title' => t('Default country'),
    '#description' => t('If field allows internal telephone numbers you can choose which country this number belongs to by default. It is highly advised to enable telephone validation for this field to ensure that telephone number is valid and can be parsed and reformatted.'),
    '#default_value' => $settings['default_country'],
    '#options' => array(
      NULL => t('- Do not use default country -'),
    ) + _telephone_formatter_get_country_codes(),
  );
  return $elements;
}