0

I need the equivalent for hook_preprocess_node for custom pages, which aren't nodes.

The particular page I need to theme is provided by the entity registration module 'node/10/register'. I can add theme suggestions for the page using hook_preprocess_page - but how to I add a theme suggestion for the actual content, so I don't have to rewrite the page.tpl.php?

Alternatively if there is an existing pattern to name the file then that would be even better.

0

You need to copy the file

entity.tpl.php 

from the theme directory of the module : entity.

Paste it into your theme's template directory, and rename it to

registration.tpl.php

Other theme suggestions are:

registration__TYPE
registration__TYPE__VIEWMODE
registration__ID

If you want to have access to the preprocess function then add this function to your theme's template.php file :

function MYTHEME_preprocess_entity(&$vars) {
  //dpm($vars);
}
  • It's not a template for the entity itself, it's the page node/10/register - which is the registration form. The registration entity itself is the submitted results of this form. – Chris Aug 29 '14 at 7:18
  • 1
    In that case you want to theme a form, and you will have to create your own theme function to do that. You need to implement hook_theme and use the form ID as the array key. Once you have a theme function then you can create a preprocess to go with it. – J. Reynolds Aug 29 '14 at 11:10

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.