You are here

function phone_field_formatter_settings_summary in Phone 7.2

Implements hook_field_formatter_settings_summary().

File

./phone.module, line 587
The phone module lets administrators use a phone number field type.

Code

function phone_field_formatter_settings_summary($field, $instance, $view_mode) {
  $display = $instance['display'][$view_mode];
  $settings = $display['settings'];
  $instance_settings = $instance['settings'];
  $field_settings = $field['settings'];
  $summary = array();
  if (!empty($settings['components'])) {
    $components = array_filter($settings['components']);
    $output = array(
      t('Number') => TRUE,
      t('Number type') => $field_settings['enable_numbertype'] && isset($components['numbertype']),
      t('Country') => isset($components['country']),
      t('Extension') => $instance_settings['enable_extension'] && isset($components['extension']),
    );
    $output = array_filter($output);
    $summary[] = t('<strong>Components:</strong> @items', array(
      '@items' => implode(', ', array_keys($output)),
    ));
  }
  $summary[] = t('<strong>Full hCard 1.0 type support:</strong>') . ' ' . ($settings['full_hcard'] ? t('Yes') : t('No'));
  $summary[] = t('<strong>As tel: link:</strong>') . ' ' . ($settings['as_tel_link'] ? t('Yes') : t('No'));
  $summary[] = t('<strong>Convert alpha to digits:</strong>') . ' ' . (!$settings['allow_alpha'] ? t('Yes') : t('No'));
  if (isset($components['country'])) {
    $summary[] = t('<strong>Country name position:</strong>') . ' ' . ($settings['country_name_position'] == 'before' ? t('Before') : t('After'));
  }
  if ($field_settings['enable_numbertype'] && isset($components['numbertype'])) {
    $summary[] = t('<strong>Number type position:</strong>') . ' ' . ($settings['numbertype_position'] == 'before' ? t('Before') : t('After'));
  }

  // RFC3966 states the extension prefix must be ;ext=.
  if ($display['type'] != 'phone_rfc3966' && $instance_settings['enable_extension'] && isset($components['extension'])) {
    $summary[] = t('<strong>Extension prefix:</strong> @prefix', array(
      '@prefix' => $settings['extension_prefix'],
    ));
  }
  return implode('<br />', $summary);
}