You are here

function double_field_field_settings_form in Double Field 7

Same name and namespace in other branches
  1. 7.2 double_field.module \double_field_field_settings_form()

Implements hook_field_settings_form().

File

./double_field.module, line 29
Defines double text field type.

Code

function double_field_field_settings_form($field, $instance, $has_data) {
  $settings = $field['settings'];
  $form['first_maxlength'] = array(
    '#type' => 'textfield',
    '#title' => t('Maximum length of the first textfield'),
    '#default_value' => $settings['first_maxlength'],
    '#required' => TRUE,
    '#description' => t('The maximum length of the first textfield in characters.'),
    '#element_validate' => array(
      '_element_validate_integer_positive',
    ),
    '#disabled' => $has_data,
  );
  $form['second_maxlength'] = array(
    '#type' => 'textfield',
    '#title' => t('Maximum length of the second textfield'),
    '#default_value' => $settings['second_maxlength'],
    '#required' => TRUE,
    '#description' => t('The maximum length of the second field in characters.'),
    '#element_validate' => array(
      '_element_validate_integer_positive',
    ),
    '#disabled' => $has_data,
  );
  return $form;
}