From a custom module in Drupal 7 I am trying to load a template after I submit and process my form.
I can load the theme fine from a page callback:
function mymodule_theme() {
$themes = array(
'mymodule_report' => array(
'template' => 'themes/mymodule_report',
'arguments' => array(),
),
);
return $themes;
}
function mymodule_menu() {
$items = array();
$items['reports/performance'] = array(
'title' => 'My Module Performance Report',
'page callback' => '_mymodule_report',
'access arguments' => array('mymodule_client'),
);
return $items;
}
function _mymodule_report() {
return theme('mymodule_report');
}
All of that works fine (e.g I can go to www.mysite.com/reports/performance and my tpl loads.). The problem is when i submit a form, after I process the form I want to pass the form data to the template, and load the same template page.
I modified the hook_theme like this:
function mymodule_theme() {
$themes = array(
'mymodule_report' => array(
'template' => 'themes/mymodule_report',
'variables' => array('parameters' => NULL),
)
);
return $themes;
}
And in my submit handler for my form after I gathered all my form values into an object ($submission), I added this at the end:
return theme('mymodule_report', array('parameters' => $submission));
All that happens is my form reloads...what am I missing?