I'm building a custom module that denies access to the site based on some custom rule.
I;ve already build the module form, variables get stored, in hook_init I do my check against the variables I set on my custom module.
What I would like to do now is to have a template behaviour like the maintenance mode one.
By default it should be a blank page with Site name and message like maintenance mode(maybe overriding html.tpl.php). The default mymodule-page.tpl.php should leave in mymodule/templates/
This page can be overridden in theme folder so the user can apply its own style, logo, region etc...
function my_custom_module_menu{
$items['my-custom-module-page'] = array(
'title' => t('My custom module title'),
'page callback' => 'my_custom_module_page_callback',
'type' => MENU_CALLBACK,
);
}
function my_custom_module_theme($existing, $type, $theme, $path) {
return array(
'my_custom_module_template' => array(
'template' => 'my-custom-module-template',
'variables' => array('variable' => NULL),
),
);
}
function my_custom_module_page_callback() {
return theme('my_custom_module_template');
}
The code above keeps the layout of the page but I would like to override the entire page.
Which hooks should I use to achieve this? How can I call this template from my hook_init?
Thanks in advance.
my_custom_module_template
, the template filename cannot bemy-custom-module
; it should bemy-custom-module-template
.