'', 'form_key' => NULL, 'pid' => 0, 'weight' => 0, 'value' => '', 'mandatory' => 0, 'email' => 1, 'extra' => array( 'width' => '', 'maxlength' => '', 'field_prefix' => '', 'field_suffix' => '', 'disabled' => 0, 'unique' => 0, 'title_display' => 0, 'description' => '', 'attributes' => array(), ), ); } /** * Implementation of _webform_theme_component(). */ function _webform_theme_textfield() { return array( 'webform_display_textfield' => array( 'arguments' => array('element' => NULL), ), ); } /** * Implementation of _webform_edit_component(). */ function _webform_edit_textfield($component) { $form = array(); $form['value'] = array( '#type' => 'textfield', '#title' => t('Default value'), '#default_value' => $component['value'], '#description' => t('The default value of the field.') . theme('webform_token_help'), '#size' => 60, '#maxlength' => 127, '#weight' => 0, ); $form['display']['width'] = array( '#type' => 'textfield', '#title' => t('Width'), '#default_value' => $component['extra']['width'], '#description' => t('Width of the textfield.') . ' ' . t('Leaving blank will use the default size.'), '#size' => 5, '#maxlength' => 10, '#weight' => 0, '#parents' => array('extra', 'width'), ); $form['display']['field_prefix'] = array( '#type' => 'textfield', '#title' => t('Label placed to the left of the textfield'), '#default_value' => $component['extra']['field_prefix'], '#description' => t('Examples: $, #, -.'), '#size' => 20, '#maxlength' => 127, '#weight' => 1.1, '#parents' => array('extra', 'field_prefix'), ); $form['display']['field_suffix'] = array( '#type' => 'textfield', '#title' => t('Label placed to the right of the textfield'), '#default_value' => $component['extra']['field_suffix'], '#description' => t('Examples: lb, kg, %.'), '#size' => 20, '#maxlength' => 127, '#weight' => 1.2, '#parents' => array('extra', 'field_suffix'), ); $form['display']['disabled'] = array( '#type' => 'checkbox', '#title' => t('Disabled'), '#return_value' => 1, '#description' => t('Make this field non-editable. Useful for setting an unchangeable default value.'), '#weight' => 11, '#default_value' => $component['extra']['disabled'], '#parents' => array('extra', 'disabled'), ); $form['validation']['unique'] = array( '#type' => 'checkbox', '#title' => t('Unique'), '#return_value' => 1, '#description' => t('Check that all entered values for this field are unique. The same value is not allowed to be used twice.'), '#weight' => 1, '#default_value' => $component['extra']['unique'], '#parents' => array('extra', 'unique'), ); $form['validation']['maxlength'] = array( '#type' => 'textfield', '#title' => t('Maxlength'), '#default_value' => $component['extra']['maxlength'], '#description' => t('Maximum length of the textfield value.'), '#size' => 5, '#maxlength' => 10, '#weight' => 2, '#parents' => array('extra', 'maxlength'), ); return $form; } /** * Implementation of _webform_render_component(). */ function _webform_render_textfield($component, $value = NULL, $filter = TRUE) { $element = array( '#type' => $component['type'], '#title' => $filter ? _webform_filter_xss($component['name']) : $component['name'], '#title_display' => $component['extra']['title_display'] ? $component['extra']['title_display'] : NULL, '#default_value' => $filter ? _webform_filter_values($component['value'], NULL, NULL, NULL, FALSE) : $component['value'], '#required' => $component['mandatory'], '#weight' => $component['weight'], '#field_prefix' => empty($component['extra']['field_prefix']) ? NULL : ($filter ? _webform_filter_xss($component['extra']['field_prefix']) : $component['extra']['field_prefix']), '#field_suffix' => empty($component['extra']['field_suffix']) ? NULL : ($filter ? _webform_filter_xss($component['extra']['field_suffix']) : $component['extra']['field_prefix']), '#description' => $filter ? _webform_filter_descriptions($component['extra']['description']) : $component['extra']['description'], '#attributes' => $component['extra']['attributes'], '#prefix' => '