Panels Integration for 5.x
Summit - June 29, 2008 - 13:54
| Project: | Page Title |
| Version: | 5.x-2.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Description
Hi,
When I install page_title on a regular node, it is working ok. So it is no issue in page_title module.
When I implement panels node_override (node/%) everything works ok, except the page_title is not shown as tag, but the normal node_title.
Has this to do with module-weight? Or is it related to: http://drupal.org/node/268318 Or is it a seperate issue?
Thanks in advance for going into this!
greetings,
Martijn

#1
This is because when you use panels to override the node/% url, the page loaded is no longer a node, it is a panels page. Modules that expect a node page to be loaded, and not a panels page will not behave as they are intended to when using panel node/% override. I believe that it is mostly modules that tries to modify the "menu" part of any node (I'm lacking in my english here; what I mean is for example breadcrumbs, menu entries and titles) that will fail when using panels node/% override. Modules that modifies other part of the node (CCK, links, filters etc) are generally not affected by panels.
A possible solution for you might be using workflow-ng (http://drupal.org/project/workflow_ng) to set the page title to a custom value during page load. I have described a way of doing that in this issue: #274004-2: Panel pages and breadcrumbs regarding breadcrumbs. But you can basically use the same approach to page titles, replacing the set breadcrumb action with set page title action.
#2
Changing this to a support request.
@summit: you could raise an issue against page_title module with a feature request to support panels pages
#3
Hi Vidar,
Could you explain with code exactly what I have to do to get this working for page_title?
Thanks in advance for your reply!
greetings,
Martijn
#4
I'm not sure what you're after. There is no coding incolved in setting workflow_ng up to set the page title.
I don't know what is required to make page_title module support panel pages if that is what you are after.
#5
Moving over to Page Title project. Panels is not able to do anything about this issue.
#6
Can you please confirm what versions of modules/core you are using here please so I can try to accurately replicate?
#7
I think I understand the problem - marking as active as I'm investigating this....
#8
I think what everyone wants (me too, me too!) is Panels integration. I.E. a field on the build/panels page that lets you set a custom page title for that panel. NodeWords (aka Meta Tags) also has an example of how to do this...
/**
* Implementation of hook_form_alter().
*/
function nodewords_form_alter($form_id, &$form) {
...
elseif ($form_id == 'panels_edit_form') {
$type = 'panels';
$id = $form['did']['#value'];
$form['submit']['#weight'] = 45;
$form['#submit']['nodewords_panels_handler'] = array();
}
...
}
/**
* Handling of edit/delete form for panels.
*/
function nodewords_panels_handler($form_id, $form_values) {
switch ($_POST['op']) {
case t('Save'):
if (isset($form_values['nodewords']) && user_access('administer meta tags')) {
_nodewords_set('panels', $form_values['did'], $form_values['nodewords']);
}
break;
case t('Delete'):
if ($form_values['confirm']) {
_nodewords_delete('panels', $form_values['did']);
}
break;
}
}
/**
* Handling of edit/delete form for panels (v2).
*/
function nodewords_panels_page_handler($form_id, $form_values) {
switch ($_POST['op']) {
case t('Save'):
if (isset($form_values['nodewords']) && user_access('administer meta tags')) {
_nodewords_set('panels', $form_values['panel_page']->did, $form_values['nodewords']);
}
break;
case t('Delete'):
if ($form_values['confirm']) {
_nodewords_delete('panels', $form_values->did);
}
break;
}
}
function nodewords_get($type = NULL, $ids = NULL, $filtered = TRUE) {
...
// Load the values from the database
if (count($ids) == 1 && ($type != 'node' || node_access('view', node_load($ids[0])))) {
$tags = _nodewords_load($type, $ids[0]);
}
else {
$tags = array();
}
...
// Prepare tags for output
$tags = _nodewords_prepare($type, $ids, $tags, $filtered);
return $tags;
}
also take a look at the _nodewords_detect_type_and_ids() function.
Jen
#9
I added panels integration in my update to this module, available here:
http://drupal.org/node/284218#comment-1077364
Jen
#10
+subscribe
#11
Since I happen to need this integration immediately I just bit the bullet and developed it!
This is not a polished solution, but a quick hack that gets the job done for me. The idea is to add another condition check in
page_title_get_title()and if the active menu matches panel's delegator, emulate its handler code to construct and retrieve the page title.Note, my fix works with Panels 3, which is the only version that will be supported going forward.
#12
Is the patch also working for D5 versions?
#13
No, this patch is only for Panels 6.x-3.x, which is a complete rewrite of Panels.
#14
I haven't worked on this since last year, silly to keep it assigned to me!
thanks dkruglyak for taking over!
Jen
#15
Yes, this pretty important. I'm curious if and when the patch will be integrated into a module release. I don't liked patching if I don't have to. Thanks for the fantastic module ... especially the term page titles introduced in the last release. awesome! cheers, kevin
#16
Anybody out there who is also still interested in a working solution for Panels 2 for Drupal 5.x.
Maybe somebody is capable of doing a backport? I would be willing to support your work with a little extra money.
#17
Patch from #11 needs work anyway cause there is no more delegator but page_manager is.
Subscribing
#18
Actually, I don't understand why Page Title doesn't work for Panels: Panels set up page title via drupal_set_title() and it should be available in Page Title module, cause it uses drupal_get_title() for fallback in page_title_get_title(). But for some reason drupal_get_title() returns wrong title there (from menu_get_active_title() function). Trying to investigate that atm.
#19
Setting it as active bug, cause I think there should not be any "integration" as Panels itself sets up titles properly via drupal_set_title() and Page Title module only needs to play nice with it.
#20
#21
Let's deal with 6.x issues separately and leave this for 5.x version as it was originally before dkruglyak spoiled it.
#22
I have a version of this module I managed to get working with Panels 5.x-1.2. I started working on it back in Page Title 5.x-2.0 but a lot has changed since then!
I thought I would have had more time since then to do a diff and see if I could merge my changes back into head for the 5.x branch, but since I don't seem to be getting around to it, this is my Page Title 5.x-2.0 version. It "works" but I'd love it if any of you devs with more time could take over and get it up to snuff for the community.
Sorry again for my tardiness!
Jen
#23
Subscribing, will look into your module Jen for a Drupal 5 site of mine.
EDIT: Hi, I am not able to get it working. it gives a taxonomy pages option, but NO panel-pages support with my small knowledge..
sorry if I am mistaken..
Greetings,
Martijn