You are here

function elements_element_info in Elements 7

Implements hook_element_info().

File

./elements.module, line 6

Code

function elements_element_info() {
  $types['emailfield'] = array(
    '#input' => TRUE,
    '#size' => 60,
    '#maxlength' => 128,
    '#autocomplete_path' => FALSE,
    '#process' => array(
      'ajax_process_form',
      'elements_process_pattern',
    ),
    '#element_validate' => array(
      'elements_validate_email',
    ),
    '#theme' => 'emailfield',
    '#theme_wrappers' => array(
      'form_element',
    ),
  );
  $types['searchfield'] = array(
    '#input' => TRUE,
    '#size' => 60,
    '#maxlength' => 128,
    '#autocomplete_path' => FALSE,
    '#process' => array(
      'ajax_process_form',
    ),
    '#theme' => 'searchfield',
    '#theme_wrappers' => array(
      'form_element',
    ),
  );
  $types['telfield'] = array(
    '#input' => TRUE,
    '#size' => 20,
    '#maxlength' => 64,
    '#process' => array(
      'ajax_process_form',
      'elements_process_pattern',
    ),
    '#theme' => 'telfield',
    '#theme_wrappers' => array(
      'form_element',
    ),
  );
  $types['urlfield'] = array(
    '#input' => TRUE,
    '#size' => 80,
    '#maxlength' => 128,
    '#autocomplete_path' => FALSE,
    '#process' => array(
      'ajax_process_form',
      'elements_process_pattern',
    ),
    '#element_validate' => array(
      'elements_validate_url',
    ),
    '#theme' => 'urlfield',
    '#theme_wrappers' => array(
      'form_element',
    ),
  );
  $types['numberfield'] = array(
    '#input' => TRUE,
    '#step' => 1,
    '#process' => array(
      'ajax_process_form',
    ),
    '#element_validate' => array(
      'elements_validate_number',
    ),
    '#theme' => 'numberfield',
    '#theme_wrappers' => array(
      'form_element',
    ),
  );
  $types['rangefield'] = array(
    '#input' => TRUE,
    '#step' => 1,
    '#min' => 0,
    '#max' => 100,
    '#process' => array(
      'ajax_process_form',
    ),
    '#element_validate' => array(
      'elements_validate_number',
    ),
    '#theme' => 'rangefield',
    '#theme_wrappers' => array(
      'form_element',
    ),
  );

  // Backported table element from https://drupal.org/node/80855
  $types['table'] = array(
    '#header' => array(),
    '#rows' => array(),
    '#empty' => '',
    // Properties for tableselect support.
    '#input' => TRUE,
    '#tree' => TRUE,
    '#tableselect' => FALSE,
    '#multiple' => TRUE,
    '#js_select' => TRUE,
    '#value_callback' => 'elements_table_value',
    '#process' => array(
      'elements_table_process',
    ),
    '#element_validate' => array(
      'elements_table_validate',
    ),
    // Properties for tabledrag support.
    // The value is a list of arrays that are passed to drupal_add_tabledrag().
    // elements_pre_render_table() prepends the HTML ID of the table to each set
    // of arguments.
    // @see drupal_add_tabledrag()
    '#tabledrag' => array(),
    // Render properties.
    '#pre_render' => array(
      'elements_pre_render_table',
    ),
    '#theme' => 'table',
  );
  return $types;
}