Problem: I have a pane on a page and I'd like the title of the pane to be output as the page title with the usual h1 tag etc. However, when I set the page title to be "From pane" I get the title output twice, once as the page title and once as the pane title. I think I've read all the Issues relating to this and the suggested solution always seem to be either to hide one of them using CSS or to just set the page title to "No title" and settle for the pane title (h2). Maybe I've misunderstood the purpose of "From pane" but it seems to make sense that it should suppress the pane's title when it is being displayed as the page's title?

I've haven't raised this as a bug or feature request because I'm happy to accept this behaviour if the maintainers say it is by design for some reason that i've missed. I just thought I'd raise the question and post up the template changes I made to achieve what I wanted in case it is of any use to other people trying to achieve the same thing. This code hides the title of any panels which have been given the "Panel title" setting on a page.

Solution:
Take a copy of panels-pane.tpl.php from panel's templates folder and copy into your own theme's template folder.
Then add two lines to the section shown below (this section starts at line 28):

  <?php print render($title_prefix); ?>
  <?php if ($title): ?>
    <?php if ($display->title_pane != $pane->pid): // NEW CODE ?>
      <h2<?php print $title_attributes; ?>><?php print $title; ?></h2>
    <?php endif; // NEW CODE ?>
  <?php endif; ?>
  <?php print render($title_suffix); ?>

Is this something that the standard template could be changed to do, or is going against its intended behaviour?
(...or is there an easier way to do this that I've missed?)
Thanks.

Comments

letrotteur’s picture

Works great for me. Would like to know why this is the normal behavior (outputting 2 the title 2 times). Will work with this template for now.

japerry’s picture

Status: Active » Closed (outdated)

Drupal 7 is no longer supported, closing.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.