You are here

function name_element_info in Name Field 7

Implements hook_element_info().

1 call to name_element_info()
_webform_defaults_name in includes/webform.components.inc
Implements Webform callback _webform_defaults_COMPONENT().

File

./name.module, line 419
Defines an API for displaying and inputing names.

Code

function name_element_info() {
  $parts = _name_translations();
  $field_info = name_field_info();
  $field_settings = $field_info['name']['settings'];
  $instance_settings = $field_info['name']['instance_settings'];
  return array(
    'name_element' => array(
      '#input' => TRUE,
      '#process' => array(
        'name_element_expand',
      ),
      '#pre_render' => array(
        'name_element_pre_render',
      ),
      '#element_validate' => array(
        'name_element_validate',
      ),
      '#theme_wrappers' => array(
        'form_element',
      ),
      '#theme' => 'name_element',
      '#show_component_required_marker' => 0,
      '#default_value' => array(
        'title' => '',
        'given' => '',
        'middle' => '',
        'family' => '',
        'generational' => '',
        'credentials' => '',
      ),
      '#minimum_components' => $field_settings['minimum_components'],
      '#allow_family_or_given' => $field_settings['allow_family_or_given'],
      '#components' => array(
        'title' => array(
          'type' => $instance_settings['title_field'],
          'title' => $parts['title'],
          'title_display' => 'description',
          'inline_css' => isset($instance_settings['inline_css']['title']) ? $instance_settings['inline_css']['title'] : NULL,
          'size' => isset($instance_settings['size']['title']) ? $instance_settings['size']['title'] : NULL,
          'maxlength' => $field_settings['max_length']['title'],
          'options' => $field_settings['title_options'],
          'autocomplete' => FALSE,
        ),
        'given' => array(
          'type' => 'textfield',
          'title' => $parts['given'],
          'title_display' => 'description',
          'inline_css' => isset($instance_settings['inline_css']['given']) ? $instance_settings['inline_css']['given'] : NULL,
          'size' => isset($instance_settings['size']['given']) ? $instance_settings['size']['given'] : NULL,
          'maxlength' => $field_settings['max_length']['given'],
          'autocomplete' => FALSE,
        ),
        'middle' => array(
          'type' => 'textfield',
          'title' => $parts['middle'],
          'title_display' => 'description',
          'inline_css' => isset($instance_settings['inline_css']['middle']) ? $instance_settings['inline_css']['middle'] : NULL,
          'size' => isset($instance_settings['size']['middle']) ? $instance_settings['size']['middle'] : NULL,
          'maxlength' => $field_settings['max_length']['middle'],
          'autocomplete' => FALSE,
        ),
        'family' => array(
          'type' => 'textfield',
          'title' => $parts['family'],
          'title_display' => 'description',
          'inline_css' => isset($instance_settings['inline_css']['family']) ? $instance_settings['inline_css']['family'] : NULL,
          'size' => isset($instance_settings['size']['family']) ? $instance_settings['size']['family'] : NULL,
          'maxlength' => $field_settings['max_length']['family'],
          'autocomplete' => FALSE,
        ),
        'generational' => array(
          'type' => $instance_settings['generational_field'],
          'title' => $parts['generational'],
          'title_display' => 'description',
          'inline_css' => isset($instance_settings['inline_css']['generational']) ? $instance_settings['inline_css']['generational'] : NULL,
          'size' => isset($instance_settings['size']['generational']) ? $instance_settings['size']['generational'] : NULL,
          'maxlength' => $field_settings['max_length']['generational'],
          'options' => $field_settings['generational_options'],
          'autocomplete' => FALSE,
        ),
        'credentials' => array(
          'type' => 'textfield',
          'title' => $parts['credentials'],
          'title_display' => 'description',
          'inline_css' => isset($instance_settings['inline_css']['credentials']) ? $instance_settings['inline_css']['credentials'] : NULL,
          'size' => isset($instance_settings['size']['credentials']) ? $instance_settings['size']['credentials'] : NULL,
          'maxlength' => $field_settings['max_length']['credentials'],
          'autocomplete' => FALSE,
        ),
      ),
    ),
  );
}