function text_field_settings_form

Implements hook_field_settings_form().

File

modules/field/modules/text/text.module, line 62

Code

function text_field_settings_form($field, $instance, $has_data) {
    $settings = $field['settings'];
    $form = array();
    if ($field['type'] == 'text') {
        $form['max_length'] = array(
            '#type' => 'textfield',
            '#title' => t('Maximum length'),
            '#default_value' => $settings['max_length'],
            '#required' => TRUE,
            '#description' => t('The maximum length of the field in characters.'),
            '#element_validate' => array(
                'element_validate_integer_positive',
            ),
            // @todo: If $has_data, add a validate handler that only allows
            // max_length to increase.
'#disabled' => $has_data,
        );
    }
    return $form;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.