I have a custom node template for a particular content type, and it seems that the "view" and "edit" tabs are missing on nodes of that type. However, it doesn't appear that the node templates typically have accesss to the $tabs array; that seems to be something that goes in page.tpl.php (which I haven't overridden or altered). It still work for other node types though, so it must be something in the node template.

When I add a dsm($tabs); to the page.tpl.php and view a node of my custom type, it displays the arrays containing the info for the tabs, so it can't be that my user doesn't have permission, or the tabs wouldn't load any info at all, right?

What should I do to my node template to fix this?

  • Do the tabs display for user1, but not for other users? If so, it may be that other users do not have permission to use a text input format on the page. The input format (on all WYSIWYG fields) needs to be one they can use. – keva Jul 23 '12 at 18:38

If you have a dsm($tabs) at the top of your page.tpl.php and it's showing it's set, nothing should be unsetting it by the time it is output later on in the template.

For example, in the default D6 page.tpl.php, it does this...

<?php if (!empty($tabs)): ?><div class="tabs"><?php print $tabs; ?></div><?php endif; ?>

and in D7 it does this...

<?php if ($tabs): ?><div class="tabs"><?php print render($tabs); ?></div><?php endif; ?>

...so, I'd take a look at the page source and see if css or something else is causing it to be hidden. For example, perhaps your theme is doing stuff like cascading a class in the body with the tabs class.

  • I looked at the page source. The tabs are not hidden, they're not rendering at all. Additionally, I just noticed that in the array output for debugging, the only keys are ones with # in front of them — so does that mean they have only meta properties, no real properties? – beth Jul 23 '12 at 18:40
  • gotcha...low hanging fruit gone :) the $tabs variable is populated by the menu_local_tabs() function. It looks at the menu items and so forth so I'd dig through any menu() items/hooks/etc you may have set that are special to that content type next. – Jimajamma Jul 23 '12 at 18:50
  • Great, I used menu_local_tabs() to create tabs on my content type and position them within the node where they belong. Thanks so much. – beth Jul 23 '12 at 18:54

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