Ever since beta5, any new node context panel pages are displaying the home page title instead of the node's title. We used to be able to pass the node's title through with a keyword argument, but this no longer seems to be honored.

I hope I'm making sense.

Comments

zach harkey’s picture

Ok, it looks like if I go into the Context tab and delete and recreate my Node ID argument, and re-enter the Title: %KEYWORD and Keyword values, my context node panel overrides will have proper page titles (the node's title will display as the page's title in the browser window). But the result is never permanent. If I continue to administer my pane configurations, the overridden node's page titles invariably revert back to the default "slogan | site name" instead of the "node title | site name".

I can't seem to figure out a pattern to what is causing this.

zach harkey’s picture

Title: Preserving the node title as page title with node overrides » Page titles not working for node context override panels
Category: support » bug

Ok, I think I see how this is working now. Somewhere along the way each content type was given its own "Panel Title" field under Layout settings. (Maybe it was always this way, this module messes with my head like no other.)

So, if I understand this correctly, for node override panels, (i.e. panel page set with Path: node/% and Node ID added as the first context argument), if you want the page title (including the html head title for the browser) to be the title of the node being viewed you must do the following:

  1. Under "Context", in the Node ID argument settings, for the "Title" field, where it says "Enter a title to use when this argument is present. You may use %KEYWORD substitution, where the keyword is specified by the administrator.", enter: %node, and for the "Keyword" field enter: node
  2. Under "Settings", the "Page title" field MUST have a value even though we will be overriding it in the next step. I put: %node because that is the only thing that makes sense to me in this situation.
  3. Under "Layout Settings" there will be a Default tab along with a tab for each content type you enabled.

    Each of these tabs has its own panel "Title" field. (Note: this "Panel Title" fieldset currently appears way down the page for Flexible layout types, where it is difficult to see. Also note that this fieldset does not appear at all if you have left the "Page title" field blank under the main Settings tab).

    In the Title field for each content type you must enter: %node. Even though the help text seems to indicate that you can leave it blank, you can't.

    Also, even though it would seem that checking "Hide title" would simply prevent the display of the $title on the page, it actually replaces the node's title with some other value (in my case: View) and continues to displays it. I think this is a bug.

I'm really not sure where I'm going with this thread. I guess it is no longer a 'bug' report, but this information was such a bitch for me to figure out that I'm reluctant to close it just yet, in case others are experiencing the same hell as I was. Maybe the above steps can be merged into the documentation or something. For now, I'm going to tweak the issue title and status.

zach harkey’s picture

Title: Page titles not working for node context override panels » Preserving the node title as page title with node overrides
Category: bug » support

There.

sun’s picture

Title: Page titles not working for node context override panels » Page titles not working for node override pages
Component: Plugins - contexts » Plugins - arguments

Confirming. If more than one content-type is enabled, and at least one content-type has an "own" display, the node's title for this separate ("own") content-type is

1) not output at all, even if both a Panel title (in settings) and Display title (in layout settings) is set.

2) output as page title AND page heading ($title) if a Display title (in layout settings) is configured, but "Hide title?" is NOT enabled.

3) replaced by the term "View" and output as page title AND page heading if a Display title is configured and "Hide title?" is enabled.

btw: #213751: $node->title removed from template variables does not resolve this issue.

sun’s picture

I've vardumped my way through Panels a bit now - some facts:

a) panels_page_view_page() retrieves and sets the correct context, keywords, and title in line 786:

drupal_set_title(filter_xss_admin(panels_page_get_title($panel_page, 'page', '')));

b) Even if I configure the Panel to disable regular Drupal regions, and also even if I disable all panes of this Panel (in this "own" display), "View" is still output.

So, erm, that would basically mean that something else actually overrides the page title.

sun’s picture

Component: Plugins - arguments » Plugins - layouts

meh... for my case, I was a bit confused with the Page Title module, and now found out that setting a page title without setting a title is simply not possible. So I'm overriding the title for certain content-types in my theme now.

Nevertheless... from your comment in #2:

In the Title field for each content type you must enter: %node. Even though the help text seems to indicate that you can leave it blank, you can't.

This particular bug is true -- Panels won't use the default display title in layout settings, nor will it use the Panel Page's title.

Also, even though it would seem that checking "Hide title" would simply prevent the display of the $title on the page, it actually replaces the node's title with some other value (in my case: View) and continues to displays it. I think this is a bug.

The reason why "View" is displayed as title is quite simple: The menu item for 'node/#', resp. 'node/#/view', registers the title "View" as menu item title. Drupal automatically sets the menu item title as page title if no other title has been set via drupal_set_title().

nadu’s picture

Thanks Zach Harkey for your solution. It works for me.

nadu’s picture

But how to hide the node title in node content, because we now have two titles in page (one for page title and one for node title)

zach harkey’s picture

StatusFileSize
new46.04 KB

Locate the node content panel (be sure you have the correct sub-tab for the content type you are trying to override), and check the box that says "Override title" but leave it blank. Also, you might want to make sure to check "Node page" as well.

Attached a screenshot.

zach harkey’s picture

Alternatively you can strip the title from the page.tpl.php for all node pages, and move it to your node-type.tpl.php files.

For example, I have the following line in my page.tpl.php:

<?php if (arg(0) != 'node' || (arg(0) == 'node' && arg(0) == 'create') || (arg(0) == 'node' && arg(2) == 'edit')): ?>
  <?php print $title ? '<h1 class="title">'. $title .'</h1>' : '' ?>
<?php endif ?>

You just have to be sure to print the title in your node.tpl.php template files.

nadu’s picture

Thanks Zach Harkey. It's works well for me. I think that helpful information in this post must be include in the panel documentation.

Shai’s picture

subscribing

jody lynn’s picture

Status: Active » Needs review
StatusFileSize
new762 bytes

I had the same problem after updating to beta5 and then making some changes. I tracked it down in this patch, which is the code equivalent to Zach's workaround. Apparently the layout settings title is being set now even though it's empty, which is having this awful effect.

smk-ka’s picture

Version: 5.x-2.0-beta5 » 5.x-2.x-dev
Component: Plugins - layouts » Panel pages
Assigned: Unassigned » smk-ka
StatusFileSize
new1.05 KB

This is also true for titles set by panel arguments, which are also completely ignored.

For example, create a panel with the URL node/%/foo and give it a default title of "Foo panel". Then add Node ID as an argument and set the page title to Foos of %node. The expected result would be the title of the argument node inserted into the page title, overriding the panel default title.

This seems to be not happening because of this logic (basically the same part Lynn has been identified):

  if ($panel_page->did == $panel_page->display->did || $panel_page->display->did == 'new') {
    return !empty($panel_page->display->title) ? $panel_page->display->title : $panel_page->title;
  }
  elseif (isset($panel_page->display->title)) {
    return $panel_page->display->title;
  }

First, it seems, when viewing a panel page, the condition
$panel_page->did == $panel_page->display->did
is always true (at least this was the case for me), resulting in either the display->title or the default title to be returned. Since display->title was empty, the default panel title was always returned, which is wrong.

Looking down the code in that function reveals that the default panel title is already returned at the very end of it, when all other possibilities to set a title yielded no results. This seems to be correct behavior, given the static nature of the default title.

However, if we remove the default panel title from above code, then the complete first if-clause can be nuked, and display->title returned whenever it is set (honestly I have no idea when this is the case).

smk-ka’s picture

StatusFileSize
new2.13 KB

Ok, sun just stopped by and explained me the mysteries he had with display titles and multiple displays recently. Together we discussed this, and came to the conclusion that titles should actually be set in the reverse order in which they are set (look at the local tasks to understand it!). Thus, 1. context, 2. layout (called display internally), and 3. general settings.

We put together a new patch where the display title is now moved after probing available contexts, and added some comments about our findings.

sun’s picture

Status: Fixed » Reviewed & tested by the community

I tested smk-ka's patch in #15 thoroughly now, using the following test plan:

  1. Created a panel for path "node/%" and added the "Node ID" argument to contexts, enabled the Panel for all content-types, enabled "Use different default display", and enabled an "own display" for two of those content-types.
  2. Set up the following title configuration:
    • Settings title: "Panel title"
    • Layout settings title in tab "Default": "Default display title"
    • Layout settings title in tab "Node ID 1 Default": "Default argument display title"
    • Layout settings title in tab "Node ID 1 Type1": "Type1 argument display title"
    • Layout settings title in tab "Node ID 1 Type2": "Type2 argument display title"
    • Context settings title for argument "Node ID": "Context title"
  3. Created node/1 of content-type Type1; node/2 of content-type Type2.
  4. Visited node/1 and "Context title" was displayed as page title.
  5. Enabled "hide title" option in layout settings for "Node ID 1 Type1".
  6. Visited node/1 and no page title was displayed.
  7. Disabled "hide title" option in layout settings for "Node ID 1 Type1".
  8. Removed/blanked out context settings title for argument "Node ID".
  9. Visited node/1 and "Type1 argument display title" was displayed.
  10. Visited node/2 and "Type2 argument display title" was displayed.
  11. Enabled "hide title" option in layout settings for "Node ID 1 Type1".
  12. Visited node/1 and no page title was displayed.
  13. Disabled "hide title" option in layout settings for "Node ID 1 Type1".
  14. Enabled "hide title" option in layout settings for "Node ID 1 Type2".
  15. Visited node/2 and no page title was displayed.
  16. Disabled "hide title" option in layout settings for "Node ID 1 Type2".
  17. Removed/blanked out layout settings title in tab "Node ID 1 Type1".
  18. Visited node/1 and "Panel title" was displayed.
  19. Enabled "hide title" option in layout settings for "Node ID 1 Type1".
  20. Visited node/1 and no page title was displayed.
  21. Disabled "hide title" option in layout settings for "Node ID 1 Type1".
  22. Created node/3 of an unrelated content-type.
  23. Visited node/3 and "Default argument display title" was displayed.
  24. Enabled "hide title" option in layout settings for "Node ID 1 Default".
  25. Visited node/3 and no page title was displayed.
  26. Disabled "hide title" option in layout settings for "Node ID 1 Default".
  27. Changed the panel path from "node/%" to "node".
  28. Visited node and "Default display title" was displayed.
  29. Enabled "hide title" option in layout settings in tab "Default".
  30. Visited node and no page title was displayed.
  31. Disabled "hide title" option in layout settings in tab "Default".
  32. Removed/blanked out layout settings title in tab "Default".
  33. Visited node and "Panel title" was displayed.
  34. Enabled "hide title" option in layout settings in tab "Default".
  35. Visited node and no page title was displayed.
  36. Disabled "hide title" option in layout settings in tab "Default".

Thus, expected behavior in a complex override setup.

summit’s picture

Status: Needs review » Reviewed & tested by the community

Subscribing, trying out above approach! greetings, Martijn

sdboyer’s picture

I'll take a look at this patch presently, and while I'm very much hoping that I can come to a similar conclusion, my history with this function doesn't have me all too hopeful. But I'll report back here once I've got something concrete.

merlinofchaos’s picture

Status: Reviewed & tested by the community » Needs work

Patch does not seem to apply.

smk-ka’s picture

Status: Needs work » Needs review
StatusFileSize
new2.09 KB

Rerolled.

merlinofchaos’s picture

Status: Needs review » Fixed

I am trusting sun's testing here, as that's a fairly long testing plan. COmmitted, but I'd appreciate it if people would keep an eyeon this issue for awhile.

Anonymous’s picture

Status: Reviewed & tested by the community » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

giorgio79’s picture

Hi Guys,

I am applying the same panel layout to 3 different content types.

When I set the Page Title on the Layout Settings screen, Default panel to %node it does not work.

It just brings in the site name.

When I set the Page Title on the Layout Settings screen inside each content type to %node then it does work, but I think this is still a bug, as the default setting should apply to all of them.

Any ideas?

Cheers,
G

giorgio79’s picture

Status: Closed (fixed) » Active
sun’s picture

Status: Active » Postponed (maintainer needs more info)

@giorgio79: There are two default layout settings tabs - one is called "Node ID # Default", the other one "Default". Did you ensure that you entered %node in the first one? Also, are you working with 5.x-2.x or beta5? This issue is fixed in current 5.x-2.x development snapshot only.

giorgio79’s picture

Thanks Sun I have 5.x-2.x or beta5. I was looking for the 5.x-2.x dev snapshot but did not find a download link on the project page.

Will try to poke around svn.

sun’s picture

Status: Postponed (maintainer needs more info) » Fixed

I guess this is fixed then.

See http://drupal.org/node/128199 for the current development snapshot. If you can wait for RC1, you are advised to wait.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

asak’s picture

If you're still having trouble, and by any chance using more then one language, and maybe don't have a translation for these nodes your trying to display correctly - check this: http://drupal.org/node/296919 .