I would like to override the entire page created by my custom module, I've used the hook_theme function but my template only affects the markup within the content region, I need to define the markup of the entire page inside the template file, including the header footer etc.

I know that this can be done in the theme but I need to to keep the template file within the module itself.

1 Answer 1


You want to override the deliver callback for the menu route. https://api.drupal.org/api/drupal/includes%21common.inc/function/drupal_deliver_page/7

But notice this might be very invasive and cause you issues later on.

  • Does this even override the html.tpl.php? Sorry I should have clarified, when I said the entire page markup I was just referencing the markup within the page div.
    – RMathas
    Commented Jun 12, 2015 at 12:15
  • Using a delivery callback circumvents all output, you basically rewrite the output that Drupal delivers - it will be your choice to decide what gets outputted.
    – lslinnet
    Commented Aug 11, 2016 at 8:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.