Closed (fixed)
Project:
Zen
Version:
7.x-5.1
Component:
PHP/JS code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
10 Feb 2011 at 04:04 UTC
Updated:
27 Nov 2014 at 09:50 UTC
Jump to comment: Most recent
Comments
Comment #1
danny_joris commentedSo it seems that 'contextual links' is the most important use for this. http://drupal.org/update/themes/6/7#title-prefix-suffix
If there are any other use cases, I'd love to know.
Comment #2
barrapontothere is the "add shortcut" link, as well.
Comment #3
johnalbinYep. :-)
Comment #5
deva1983 commentedHey there,
Not sure if bumping this old thread is the way to go, but I thought the subject fit my question quite nicely.
I've been trying to use $title_prefix and _suffix in my template, in order to prefix/suffix all titles of a specific content type with set strings.
i.e. "I like to " "get down in the mud" " and get dirty like peeg!"
So I populate them in my module more or less like so:
In teaser view, they get added all right. However in page view, the title is provided by page.tpl.php with those vars unpopulated, and the ones that I have set appear on their own after the tabs.
Now, ok, I understand how this happens, and I've read about how http://drupal.org/update/themes/6/7#title-prefix-suffix proposes to render those even when the title is not. I also see how there's no conditional logic relating to $node in page.tpl.php, and that's neat, too.
However, in this case, the title rendered by the page template is actually the node title, and the _prefix and _suffix end up just being pieces of content with misleading names.
So I was wondering whether this is intended behavior or if maybe those vars are not for my use case at all. I mean, for the purposes of my project I could just hardcode the strings in the templates themselves and save myself some CSS trouble too.
Or would it make sense to print the node's title_prefix and _suffix instead of the page's when there's an automatically loaded one on a page template?
I haven't actually managed to get the var from the page template (maybe _preprocess_node hasn't ran at that point? I'm not a total noob but a noob nonetheless) but I would be happy to try my hand at a patch if someone pointed me at the right direction. And if my take on the subject makes any sense, of course.
Comment #6
barrapontoIf you want a variable to be available in page.tpl.php, you probably need to set it in preprocess_page instead of preprocess_node.
Comment #7
deva1983 commentedYeah, figured that much. What I was talking about, however, was whether the implementation of title_prefix and title_suffix is supposed to work this way.
In full node pages, the page title becomes the node title, while the node title is not displayed. Wouldn't it be reasonable for it to get the node's title_prefix and _suffix too?
Currently if I want to wrap node titles in prefixes/suffixes both in node and teaser views, I have to populate both page titles with _preprocess_page for full node views and node titles with _preprocess_node for teaser views.
Just asking if that behavior is intended.
Comment #8
durum commentedbump
Comment #9
jeebsuk commentedI would also be interested to know about an answer to this as I've been experimenting with these properties over the last day or so with absolutely zero success thus far.