1

Is it possible to move the displayed page title (h1) and the local task tabs below it (the 'view' and 'edit' node tabs) to a region? Panels displays these by default for node/% page overrides.

I can add the local task tabs to a region of my choice, but I can't see how to remove the default node local task tabs.

And while I can set the page variant to 'no title', that's not really what I need, I want to define the region where it should be shown. I can add the 'Page title' from the page elements Panels content in the region I want, but it is empty when I set the page variant to 'no title'. I could add the title field and wrap it in h1 tags myself so I can use the 'no title' setting, or hide the first occurrence of the h1 with css and use the extra 'Page title' element, but it seems there should be a better way.

0

3 Answers 3

2
+50

If you're just wanting to do that for a single variant, you may need a combination of panels configuration, e.g adding local tasks and page title to region as well as either hook_preprocess_page or perhaps hook_ctools_render_alter to remove the page title and tabs from default output based on path or other criteria.

For example:

template.php

/**
 * hook_preprocess_page
 * Alter variables for the page template
 */
function THEME_preprocess_page(&$vars){
  // If on a node page
  if ($node = menu_get_object('node')) {
    // Remove page title and menu tabs for this node type
    // as they're output in the panel variant instead
    if ($node->type == 'my_type') {
      $vars['title'] = FALSE;
      $vars['tabs'] = FALSE;
    }
  }

}
3
  • Can you elaborate on the second part, how to remove page title and tabs for a particular variant?
    – arjan
    Jan 3, 2013 at 12:22
  • @arjan example preprocess_page snippet to remove title and tabs from default page.tpl output added. Jan 3, 2013 at 20:42
  • I had to use $vars['primary_local_tasks'] = FALSE;, although ['tabs'] was also present. Related issue.
    – arjan
    Jan 11, 2013 at 15:36
2

If you want to remove or otherwise affect the page-level elements, such as menus, that's out of scope for Panels, as it only deals with the content/entity being displayed.

Panels everywhere however does for the page template what panels does for the node template and can be applied selectively to pages with selection rules just like other variants.

2
  • Looks like I should look into using Panels everywhere for future projects (converting the current site to it may be too much work).
    – arjan
    Jan 8, 2013 at 14:47
  • 1
    No need to convert the whole site in one go. Set a restrictive selection rule, and PE will fall back to the page template for everything that doesn't fit.
    – Letharion
    Jan 9, 2013 at 11:09
0

Have you tried using the Title module? It transforms the Title property to a full Field API field with all the benefits coming with that. As a bonus it will also be fully translatable too.

1
  • 1
    But adding the title to a region isn't the problem, preventing the default page title + local tasks tabs from always rendering is. Title module wouldn't affect that would it?
    – arjan
    Jan 3, 2013 at 14:50

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.