I have a custom module with one form inside of it:
function emuforms_bistatistics_form($form, &$formstate){
$form['#id'] = 'bistatistics';
$form['headings'] = array(
'#markup' => '<hgroup><h3>Instruction Statistics Form</h3>
<h4>Please Fill Out Form Completely for Each Instructional Session.</h4></hgroup>'
);
$form['general'] = array(
'#title' => t('General'),
'#type' => 'fieldset',
'#collapsible' => TRUE,
'#collapsed' => FALSE
);
...etc
}
For this form I have created a menu link...
function emuforms_menu(){
$items['emuforms'] = array(
'title' => 'Forms and Tools 2',
'page callback' => 'drupal_get_form',
'page arguments' => array('emuforms_bistatistics'),
'access callback' => TRUE,
'type' => MENU_NORMAL_ITEM,
);
return $items;
}
...And a preprocess() function...
function emuintranet_preprocess_emuforms_bistatistics_form(&$variables){
$variables['emuforms_bistatistics'] = array();
$hidden = array();
...etc
}
...And a theme() function
function emuforms_theme(){
return array(
'emuforms_bistatistics' => array(
'render element' => 'form',
'template' => 'emuforms-bistatistics',
),
);
}
Here's the Problem: The 'page arguments' => array('emuforms_bistatistics') follows the link to my custom .tpl.php file when I set it in this manner. However, I get several errors:
1) Notice: Undefined index: emuforms_bistatistics in include() (line 9 of /home/libintranet/htdocs/sites/all/modules/emuforms/emuforms-bistatistics.tpl.php).
2) Notice: Undefined index: emuforms_bistatistics in drupal_retrieve_form() (line 764 of /home/libintranet/htdocs/includes/form.inc).
3) Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'emuforms_bistatistics' not found or invalid function name in drupal_retrieve_form() (line 799 of /home/libintranet/htdocs/includes/form.inc).
On the other hand If I set 'page arguments' => array('emuforms_bistatistics**_form**'), I get no errors. HOWEVER, the path no longer follows to my .tpl.php file. Rather, it just displays my form directly from the _form function.