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?

1 Answer 1

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;
    }
  }
}
2
  • Many thanks, I was looking for hours, but couldn´t get it right. Your solution does the trick (and it looks so easy).
    – Kay
    Commented Jan 29, 2012 at 14:37
  • If this is the answer you're looking for it you should mark it as such.
    – Chapabu
    Commented Jan 30, 2012 at 14:40

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.