2

I've searched/asked around without success.

I'm creating a custom Drupal 7 module, and I would like to render the code in an empty full template (not a page/node.tpl.php); by full template I mean a template containing the <html> tag.

Since now, I've used the following code but the template is rendered in page.tpl.php (render($page['content'])).

function mymodule_theme() {
  return array(
    'adm_xyz' => array (
      'render element' => 'render',
      'template' => 'adm_xyz', //  template *.tpl.php
    ),
  );
}
5

Your callback in hook_menu() will by default call drupal_deliver_html_page() which in turn calls drupal_render_page() where the page.tpl.php comes from.

It is possible to implement your own "delivery callback" method, which will be called by drupal_deliver_page() this is how the ajax is delivered in D7

2
  • Good answer. Still I am curious what could possibly go wrong if you simply print + exit() in the page callback? – donquixote Aug 18 '17 at 19:41
  • Nothing else will be able to alter page structure. Late hooks will not get called. – Jeremy French Aug 18 '17 at 19:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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