Ho trovato un tutorial per creare un elemento personalizzato per drupal 6 al seguente link:

http://www.akchauhan.com/create-drupal-form-elements-like-date-element/

Ed ho tentato di adattare il codice per drupal 7 nel seguente modo:

<?php
function calendartry2_element_info() {
    return array(
   
'height' => array(
        
'#input' => TRUE,
        
'#process' => array('height_process'),
        
'#element_validate' => array('height_validate'),
      ),);
}

function
height_process($element) {
   
// Assigning default values to element. You can override these values by passing your own values using "#default_value".
   
if (empty($element['#value'])) {
       
$element['#value'] = array(
             
'feet' => '-',
             
'inch' => '-',
        );
      }

   
$element['#tree'] = TRUE;

   
$parents = $element['#parents'];
   
$parents[] = 'feet';
       
$element['feet'] = array(
         
'#type' => 'select',
       
'#default_value' => $element['#value']['feet'],
       
'#options' => array('-' => '-', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', '7' => '7', '8' => '8',),
       
'#suffix' => t('ft.'),
        );

   
$parents = $element['#parents'];
       
$parents[] = 'inch';
       
$element['inch'] = array(
       
'#type' => 'select',
       
'#default_value' => $element['#value']['inch'],
       
'#options' => array('-' => '-', '0' => '0', '1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6',
           
'7' => '7', '8' => '8', '9' => '9', '10' => '10', '11' => '11'),
       
'#suffix' => t('in.'),
        );

    return
$element;
}


function
height_validate($element) {
      if (
trim($element['#value']['feet']) == '-' || trim($element['#value']['inch']) == '-') {
           
form_error($element, t('The specified height is invalid.'));
      }
}

function
theme_height($element) {
      return
theme('form_element', $element, '<div class="container-inline">'. $element['#children'] .'</div>');
}

function
calendartry2_theme() {
    return array(
       
'height' => array(
             
'variables' => array('element' => NULL))
      );
}
?>

inserendo nella funzione hook_menu() il seguente codice per poter richiamare l'oggetto:

<?php
// Create element of 'type' height
       
$form['altezza'] = array(
       
'#type' => 'height',
       
'#title' => t('Height'),
       
//'#required' => TRUE,
       
'#default_value' =>  array('feet' => '-', 'inch' => '-'),
    );
?>

Drupal 7 non mi rileva nessun errore ma non mi visualizza comunque nulla. Avete qualche consiglio da darmi?
Grazie in anticipo.