Hi,
I'm struggling with custom elements in Drupal 7. Basically, what i would like to do is to create a custom form element which i can reuse and add to several of my forms.
This is the first time i try to create a custom element, but i believe the following functions are what i need to define one:
hook_element_info() : define the element.
hook_theme() : define theme function for the element.
theme_reporting_tableselect() : the implementation of the theme function.
I do not receive any errors; Drupal just won't display the element. Any ideas?
/**
* Implementation of hook_element_info();
*/
function reporting_element_info() {
return array(
'reporting_tableselect' => array(
'#input' => true,
'#process' => array('reporting_tableselect_process'),
'#element_validate' => array('reporting_tableselect_validate'),
),
);
}
/**
* Implementation of hook_theme();
*/
function reporting_theme() {
return array(
'reporting_tableselect' => array(
'render element' => 'element',
),
);
}
function theme_reporting_tableselect($element) {
dpm('theme_reporting_tableselect()');
return '
element
';
}
function reporting_tableselect_process($element) {
dpm('reporting_tableselect_process()');