example_element_expand

Versions
5
example_element_expand($element)

Our process callback to expand the control.

Code

developer/examples/example_element.module, line 64

<?php
function example_element_expand($element) {
  $element['#tree'] = TRUE;
  
  if (!isset($element['#value'])) {
    $element['#value'] = array('areacode' => '', 'number' => '', 'extension' => '');
  }
  
  $element['areacode'] = array(
    '#type' => 'textfield',
    '#size' => 3,
    '#maxlength' => 3,
    '#value' => $element['#value']['areacode'],
    '#prefix' => '(',
    '#suffix' => ')',
  );
  $element['number'] =  array(
    '#type' => 'textfield',
    '#size' => 8,
    '#maxlength' => 8,
    '#required' => TRUE,
    '#value' => $element['#value']['number'],
  );
  $element['extension'] =  array(
    '#type' => 'textfield',
    '#size' => 10,
    '#maxlength' => 10,
    '#prefix' => t('ext'),
    '#value' => $element['#value']['extension'],
  );

  return $element;
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.