Posted by brennino on December 8, 2009 at 10:04pm
| Project: | Page Title |
| Version: | 6.x-2.3 |
| Component: | Miscellaneous |
| Category: | bug report |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | needs work |
Issue Summary
I set a pattern for the taxonomy title and I set the check on the "show field" checkbox.
After that I go to the taxonomy "edit term" page for my term and I try to write a custom title valid only for that term.
I see that my custom title has not overwritten by the module but my page has again the default pattern for taxonomy that I set.
Is this the correct behavior?
I think that the custom title for a term must overwrite the default pattern I set in module configuration.
Have anyone seen this behavior?
Comments
#1
Am having the same problem.
#2
Looking at what's going on in the code, I don't see it even trying to load the overridden value for terms (or anything else for that matter) in page_title_page_get_title(). I'll see if I can come up with a patch to fix it.
#3
Changing the priority to Critical as this key functionality does not work in 6.x-2.3.
Here's a patch that makes the following changes to page_title_page_get_title():
Also:
This has allowed the page title to work as intended: if a page title is manually overridden load it first, otherwise use the pattern structure.
#4
In the interests of making it easier for beginners, I've bundled the latest code from the v6.x-2.x branch together with my patch: http://www.mc-kenna.com/drupal/2010/01/archive-of-page-title-module-with...
#5
FYI this also rolls in the fix from #654672: Invalid title on forum root.
#6
Looking at the code again, should the manually configured titles also be processed for tokens? Is there a reason why I can't set the title for a node to "something | [site-name]" and expect it to process the token?
#7
I've added a new ticket for processing manually-assigned titles: #689620: Pattern for processing manually-assigned page titles
#8
An "undocumented feature" in Panels and a page_title misconfiguration was causing this for me.
#9
To clarify:
#10
I'd like the field on the taxonomy term page to provide the token substitution for [page-title], but I want my $head_title to print out [page-title] | [site-name] (just like we can do with nodes).
I'm not sure this is possible with the current patch, though I may be mistaken.
I've set my default pattern to be: [page-title] | [site-name].
I've entered in my custom page title text on the term's edit form.
And my resulting page title is only [page-title].
The " | [site-name]" part is missing.
I think the behavior should be the same for nodes and terms, but I'm not really sure how to get there.
#11
FWIW, we ended up writing our own token. If the pattern is set, and the "show field" is checked, it will use the custom page_title if set, otherwise it will use the set pattern.
Here's an example of the token we setup:
hook_token_list().
*/
function mymod_token_list($type = 'all') {
$tokens = array();
if ($type == 'taxonomy' || $type == 'all') {
if (module_exists('page_title')) {
$tokens['taxonomy']['mymod-page_title'] = t("Page title because ignores defaults.");
}
}
return $tokens;
}
/**
* Implementation of hook_token_values().
*/
function mymod_token_values($type, $object = NULL) {
$values = array();
if ($type == 'taxonomy') {
if (module_exists('page_title')) {
$term_title = page_title_load_title($object->tid, 'term');
$values['mymod-page_title'] = !empty($term_title) ? $term_title : $object->name;
}
}
return $values;
}
#12
Neither of the 2 approaches work for me.
Firstly I tried from project's page the 6-dev version, then I tried the code from McKenna's site.
Finally I tried added the techgirlgeek's code in my page_title.module file which gave me a WSOD.
#13
@chefarov the code from @techgirlgeek was missing some comment markers at the beginning. Did you catch that? Try this:
/**
* Implementation of hook_token_list()..
*/
function mymod_token_list($type = 'all') {
$tokens = array();
if ($type == 'taxonomy' || $type == 'all') {
if (module_exists('page_title')) {
$tokens['taxonomy']['mymod-page_title'] = t("Page title because ignores defaults.");
}
}
return $tokens;
}
/**
* Implementation of hook_token_values().
*/
function mymod_token_values($type, $object = NULL) {
$values = array();
if ($type == 'taxonomy') {
if (module_exists('page_title')) {
$term_title = page_title_load_title($object->tid, 'term');
$values['mymod-page_title'] = !empty($term_title) ? $term_title : $object->name;
}
}
return $values;
}