Steps to reproduce:

  1. Install fresh Drupal site and download CTools 7.x-1.x
  2. Create a new "Article" node ...
    • ... with the title "Page title"
    • Click "Provide menu link" and set the Menu link title to "Menu title"
    • Click "Save"
  3. Click the "Edit" tab, and notice that the page title is correctly "Edit Article Page title"
  4. Enable the Page Manager module
  5. Go to "Admin" -> "Structure" -> "Page"
  6. Enable the "Node add/edit form" page (but don't edit it)
  7. Go back to the node edit form for the node we created in step #2 (probably at /node/1/edit if you really installed fresh)
  8. Notice that the page title is INCORRECTLY set to "Menu title"

I'm really not sure how it gets set to the menu link title, but there is nothing in Page Manager to set the default page title in case no variants are selected on the "Node add/edit form" page. The expected behavior is that if no variant is selected, that we simply fallback on the default Drupal behavior.

Comments

dsnopek created an issue. See original summary.

dsnopek’s picture

Issue summary: View changes

Fixing type-o's.

dsnopek’s picture

Status: Active » Needs review
StatusFileSize
new1.15 KB

Here's a patch that works in my testing!

dsnopek’s picture

Status: Needs review » Needs work

I've found a flaw in this patch. This same callback is being used for 'add' pages as well as 'edit', but this always shows the title for 'edit'. It needs to check if there is a node already or not!

dsnopek’s picture

Status: Needs work » Needs review
StatusFileSize
new1.34 KB
new1.33 KB

Here's a new patch that takes into account the node add page as well!

cboyden’s picture

Status: Needs review » Reviewed & tested by the community

We're using this patch and it's working well.

rivimey’s picture

joelpittet’s picture

joelpittet credited Shaney.

joelpittet credited kruser.

joelpittet’s picture

joelpittet credited Neo13.

joelpittet credited uq.

joelpittet’s picture

joelpittet’s picture

Status: Reviewed & tested by the community » Fixed

Thanks everybody for the fix and I've credited a bunch of people form #1369852: Page Manager displays menu title instead of node title too which had a similar RTBC patch. Committed to dev for next release (today)

  • joelpittet committed 03b5db2 on 7.x-1.x authored by dsnopek
    Issue #2673298 by dsnopek, joelpittet, darrenwh, geophysicist, joelstein...

Status: Fixed » Closed (fixed)

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

jfuentes’s picture

This solution unnafortunatelly breaks the developments of modules that alter the node add/edit titles using. the $form["#after_build"][], that worked fine during lot of years, and after this update dissapeared showing ugly titles to final users with the content type name.

mustanggb’s picture

Anyone have a workaround for this to let modules set titles?

Previously it was working with a hook_form_node_form_alter(), but not anymore.

EDIT:

Have managed to workaround with:

hook_ctools_render_alter() {
  if ($context['task']['name'] == 'node_edit') {
    drupal_set_title('Custom title here');
  }
}