I have this code that implements hook_form_alter for durpal search form and adds couple of new elements there. I have also added theme overwrite code in my template.php for the said form. In addition to this, I also pass form elements there. Everything works fine - adds new elements, theme is used;but, here's the problem. When I try to render each element of form with drupal_render, it doesn't show up anything. I've checked the contents of $form array and, it has all the necessary form data. This is the except of my code -
mymod.module
function mymod_form_alter(&$form, $form_state, $form_id) {
switch ($form_id) {
case 'search_theme_form':
$form['prop_type'] = array(
'#type' => 'select',
'#default_value' => 'Selection A',
'#options' => array("Selection A","Selection B"),
'#attributes' => array('class'=>'Bold'),
);
break;
}
}
template.php -
function mytheme_theme() {
return array(
'search_theme_form' => array(
'arguments' => array('form' => NULL),
'template' => 'search_myblock_form',
),
);
}
And there is also one weird problem, which is, devel's dsm couldn't even show what's inside $form. I had to use print_r to get the string value first and feed it to dsm for display. For what is worth, another thing is, inside my theme template, there is this variable($search_form) with all my form elements rendered. As I want to theme individual element in different way, I can't use it; I like to render individual element by myself.