In Drupal 7, I'm creating thank you page for a custom form and have following in my mymodule.module
:
function mymodule_menu() {
$items = array();
$items['mymodule/thank_you/%'] = array(
'title' => 'My Module Thank You Page',
'description' => 'my module thank you page',
'page callback' => 'mymodule_thank_you_page',
'access arguments' => array( 'access mymodule thank you page' ),
'type' => MENU_NORMAL_ITEM,
);
return $items;
}
function mymodule_theme() {
return array(
'mymodule_thank_you' => array(
'variables' => array(
'form_id' => NULL,
'content' => NULL,
'title' => NULL,
),
'template' => 'thank-you',
'file' => 'mymodule.theme.inc',
'path' => drupal_get_path('module', 'mymodule') . '/templates',
),
);
}
function mymodule_thank_you_page() {
drupal_set_title( t( 'Thank You.' ) );
$variables = array();
return theme( 'mymodule_thank_you', $variables );
}
In mymodule.theme.inc
, I have:
function template_preprocess_mymodule_thank_you( &$variables ) {
$variables['title'] = 'test';
}
The problem I'm facing is that while I can access the thank-you template correctly, it doesn't read any of the variables I define in the preprocess function in the theme.inc
file. Can anyone advice what I'm doing wrong for this?