You are here

function phone_field_settings in Phone 5

Same name and namespace in other branches
  1. 6 phone.module \phone_field_settings()

Implementation of hook_field_settings().

File

./phone.module, line 28
Defines phone number fields for CCK. Provide some verifications on the phone numbers

Code

function phone_field_settings($op, $field) {
  switch ($op) {
    case 'form':
      $form = array();
      $form['phone_country_code'] = array(
        '#type' => 'checkbox',
        '#title' => t('Add the country code if not filled by the user'),
        '#default_value' => isset($field['phone_country_code']) ? $field['phone_country_code'] : '',
      );
      return $form;
    case 'save':
      return array(
        'phone_country_code',
      );
    case 'database columns':
      if ($field['type'] == 'fr_phone' || $field['type'] == 'it_phone' || $field['type'] == 'ca_phone' || $field['type'] == 'uk_phone' || $field['type'] == 'ru_phone') {
        $columns = array(
          'value' => array(
            'type' => 'varchar',
            'length' => 255,
            'not null' => TRUE,
          ),
        );
      }
      return $columns;
  }
}