You are here

function phone_field_settings_form in Phone 7.2

Same name and namespace in other branches
  1. 7 phone.module \phone_field_settings_form()

Implements hook_field_settings_form().

File

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

Code

function phone_field_settings_form($field, $instance, $has_data) {
  $defaults = field_info_field_settings($field['type']);
  $settings = array_merge($defaults, $field['settings']);
  $form = array();
  $form['enable_numbertype'] = array(
    '#type' => 'checkbox',
    '#title' => t('Enable phone number type support'),
    '#default_value' => $settings['enable_numbertype'],
    '#description' => t('Check this to enable the phone number type field.'),
    '#weight' => -2.2,
  );
  $module_path = drupal_get_path('module', 'phone');
  $form['numbertype_allowed_values'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Number type allowed values list'),
    '#default_value' => $settings['numbertype_allowed_values'],
    '#element_validate' => array(
      'phone_numbertype_allowed_values_setting_validate',
    ),
    '#field_has_data' => $has_data,
    '#field' => $field,
    '#options' => phone_numbertype_all_values($field, $instance),
    '#states' => array(
      'visible' => array(
        ':input[name="field[settings][enable_numbertype]"]' => array(
          'checked' => TRUE,
        ),
      ),
    ),
    '#attached' => array(
      'css' => array(
        $module_path . '/theme/phone-settings.css',
      ),
    ),
  );
  return $form;
}