3

I have a little function to hide my node titles via template.php:

function mytheme_alpha_preprocess_page(&$vars) {
  if (isset($vars['node']) && $vars['node']->type == 'episode') {
    $vars['title_hidden'] = TRUE;
  }}

This function hides the title on the node edit form too, but for that form I need a title.

How can I avoid changing the node edit form in my function?

5

You could add a check to see if you are editing the node, like

function mytheme_alpha_preprocess_page(&$vars) {
  if (isset($vars['node']) && $vars['node']->type == 'episode') {
    if(arg(2) != 'edit') {
        $vars['title_hidden'] = TRUE;
    }
  }
}
| improve this answer | |
  • Many thanks, I was looking for hours, but couldn´t get it right. Your solution does the trick (and it looks so easy). – Kay Jan 29 '12 at 14:37
  • If this is the answer you're looking for it you should mark it as such. – Chapabu Jan 30 '12 at 14:40

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.