After I Panelize a node, on the node display, it starts displaying the Menu title as the Page title instead of the Node's title.

Members fund testing for the Drupal project. Drupal Association Learn more

Comments

merlinofchaos’s picture

Status: Active » Postponed (maintainer needs more info)

The menu title of the node display should be the page title:

From node_menu():

  $items['node/%node'] = array(
    'title callback' => 'node_page_title', 
    'title arguments' => array(1),
    // The page callback also invokes drupal_set_title() in case
    // the menu router's title is overridden by a menu link. 
    'page callback' => 'node_page_view', 
    'page arguments' => array(1), 
    'access callback' => 'node_access', 
    'access arguments' => array('view', 1),
  );
kruser’s picture

It seems strange that before it is panelized, the node shows the node's title, then after it's panelized, it starts using the Menu link title. See the Screencapture: http://screencast.com/t/ltKuIxwc

Once that happens, you can't change to the title on the page without changing the menu link title.

merlinofchaos’s picture

Status: Postponed (maintainer needs more info) » Active

All right. It does appear that http://api.drupal.org/api/drupal/modules--node--node.module/function/nod... does an additional title set that I didn't realize it needed to do. That'll mean fixing the API to properly set the title from an entity. That shouldn't be too difficult, I think.

dbassendine’s picture

Just to note this issue also affects the 6.x version.

I'm not familiar enough with Panels or Panelizer to take a crack at this directly, but here's a temporary workaround to revert this in the theme layer:

/**
 * Preprocess panel pane
 */
function themename_preprocess_panels_pane(&$vars) {
  // Override Panelizer's page title override
  if ($vars['display']->context['panelizer']->data->title) {
    drupal_set_title($vars['display']->context['panelizer']->data->title);
  }
}
merlinofchaos’s picture

Status: Active » Fixed

This actually needs to be fixed in CTools. I just checked in a fix there.

merlinofchaos’s picture

Project: Panelizer » Chaos tool suite (ctools)
Version: 7.x-2.0-beta2 » 7.x-1.x-dev
merlinofchaos’s picture

Title: Panelizer displays menu title instead of node title » Page Manager displays menu title instead of node title

Adjusting title; this is NOT unique to Panelizer at all.

Status: Fixed » Closed (fixed)

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

neclimdul’s picture

Version: 7.x-1.x-dev » 6.x-1.x-dev
Status: Closed (fixed) » Patch (to be ported)

Seems like this should be back-ported. With the nod from earl I'll cherry-pick the commit back.

neclimdul’s picture

Status: Patch (to be ported) » Fixed

done.

Status: Fixed » Closed (fixed)

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

Isostar’s picture

Version: 6.x-1.x-dev » 7.x-1.9
Issue summary: View changes
Status: Closed (fixed) » Active

Exactly the same bug seems active again in 7.x-1.9
I use the page title panel in websites with panels everywhere.

Problem was seen after upgrading from 1.7 -> 1.9. (Tested on several sites)
After downgrading problem was gone.

jtjones23’s picture

I'm seeing the same issue after upgrading from 1.7 -> 1.9. After downgrading to 1.7, the problem goes away.

Update: Solved by disabling the Menu Position module and using Custom Breadcrumbs instead. Now I can use ctools 7.x-1.9

Neo13’s picture

I can confirm the issue.

jessehs’s picture

I encountered an issue where the Panels default content had a title that was left empty. (The "Title type" option was "Manually set".) When a node had a menu item, the menu item appeared as the page title. If I changed the title of the panels page to "%node:title" the problem was solved.

This problem existed for the node_view panels page default display as well as the Panelizer default configuration.

Also note that the site was using the Menu Position module, although I did not confirm whether disabling it changed anything.

EDIT: Out of curiosity I tried disabling Menu Position, and it did not fix the issue.

dela.deyoungster’s picture

Thanks @Jessehs. Your suggestion of using the %node:title for the panels page worked great for me ;). I was having this issue while working with Open Atrium.

Cheers,
Dela.

PS:
The setting for the panels page title is found under: "admin/structure/types/manage/[node-type]/panelizer/page_manager/content".

joelstein’s picture

#15 was the right approach for me, too. Thanks!

joelstein’s picture

nicholsj’s picture

(Apologies if this should be logged as a new issue - but from what I can tell it's related to the above)

(Drupal 7.43)

Since upgrading Ctools module from 1.4 to 1.9 we've got a problem with title fields not displaying on our Press Relase content type.

Instead of "Press Release: [title of press release]"
we're getting "Press Release: [parent menu title]"

Reverting to Ctools 1.7 solves the issue, 1.8 onwards causes it.

Here's the relevant snippet from \preprocess\node.preprocess.inc

if($publish_date < strtotime('-1 year')) {
          $variables['title'] = t('Archived press release') . '<br />' . drupal_get_title();
        } else {
          $variables['title'] = t('Press release') . '<br />' . drupal_get_title();
        }

and drupal_get_title:

 function drupal_get_title() {
    $title = drupal_set_title();
      // During a bootstrap, menu.inc is not included and thus we cannot provide a title.
    if (!isset($title) && function_exists('menu_get_active_title')) {
    $title = check_plain(menu_get_active_title());
    }
    return $title;
    }

Any suggestions much appreciated

geophysicist’s picture

I found best solution for this issue. If you want to use last CTools module version and do not patch it - just create your own custom module or use existing one with system weight less then 0 and implement there hook_node_view where you can call drupal_set_title($node->title).
It helps me with my issue - wrong og:title tag.

Shaney’s picture

I've tracked down the cause of this. It's due to the refactoring of the page_manager_node_view_page($node) function in the node_view task from page manager.

Previous to version 7.x-1.8 the node title was set early in the function, before any attempts to generate content. This was done either by the node being explicitly set via drupal_set_title($node->title), or the default content being generated by $default_output = node_page_view($node); which sets the title.

Now the default content is only generated if the page_manager fails to render its version. So at the point the page manager content is generated, no title has been explicitly set.

We can then see from drupal_get_title() that that it falls back to the active menu title. Weirdness ensues.


function drupal_get_title() {
  $title = drupal_set_title();

  // During a bootstrap, menu.inc is not included and thus we cannot provide a title.
  if (!isset($title) && function_exists('menu_get_active_title')) {
    $title = check_plain(menu_get_active_title());
  }

  return $title;
}<code></code>

To keep the benefits of not rendering the default content, adding a direct call to drupal_set_title early in the function seems a simple solution. Have attached a patch

rivimey’s picture

Version: 7.x-1.9 » 7.x-1.x-dev
Status: Active » Needs review
Issue tags: +Needs tests

Shaney, thanks for your patch, it looks reasonable.

Is there a chance of you adding simpletests for this functionality, as this area seems prone to getting broken!

darrenwh’s picture

Status: Needs review » Needs work

Needs tests

Anybody’s picture

#21 works great. The issue still exists and is really weird... simpletest would be very nice but the current behaviour is even worse since 12 month... so if nothing changed I think an RTBC would be better than a test ... ;)

+1 for RTBC!

rivimey’s picture

Status: Needs work » Reviewed & tested by the community
axel.rutz’s picture

Issue tags: +low-regression-risk