Hello All,
This must be a simple thing to do but i can't seem to get my head around it:
- I have got a content type 'publication' - A publication can have two possible physical formats: "normal", "electronic" - When a publication has physical format "electronic" i'd like to alter my title field in al my view modes (i use display suite) like this "Some Title (electronic)"
I've been trying theme_preprocess_node function but to no avail. I've also tried hook_node_view, but there i have my title field already as markup in an array so i can't just alter the title itsself.
I'm very much stuck on a simple thing here i guess. Any help would be greatly appreciated.
Thanks beforehand!
Best,
Toon
How about hook_node_view_alter()? I've never tried it, but I'd really think hook_node_view() would be the right place. There are also some field and entity hooks that fire before that.
Nancy
Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King, Jr.
From: toon severijns This must be a simple thing to do but i can't seem to get my head around it:
- I have got a content type 'publication'
- A publication can have two possible physical formats: "normal", "electronic"
- When a publication has physical format "electronic" i'd like to alter my title field in al my view modes (i use display suite) like this "Some Title (electronic)"
I've been trying theme_preprocess_node function but to no avail. I've also tried hook_node_view, but there i have my title field already as markup in an array so i can't just alter the title itsself.
Have you tried hook_node_load()?
Cheers, Eric
On Tue, Oct 2, 2012 at 11:42 AM, Ms. Nancy Wichmann nan_wich@bellsouth.net wrote:
How about hook_node_view_alter()? I've never tried it, but I'd really think hook_node_view() would be the right place. There are also some field and entity hooks that fire before that.
Nancy Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King, Jr.
From: toon severijns This must be a simple thing to do but i can't seem to get my head around it:
I have got a content type 'publication' A publication can have two possible physical formats: "normal", "electronic" When a publication has physical format "electronic" i'd like to alter my title field in al my view modes (i use display suite) like this "Some Title (electronic)"
I've been trying theme_preprocess_node function but to no avail. I've also tried hook_node_view, but there i have my title field already as markup in an array so i can't just alter the title itsself.
-- [ Drupal support list | http://lists.drupal.org/ ]
Hello,
Thanks for the advice! I am stuck though on how to keep the formatting from Display Suite and only alter the field value. The node in hook_view_node is a structured array with the element '#markup' containing e.g. "<h4>Title</h4>". I'd need to just alter the value and not worry about the formatting. Any ideas?
Best,
Toon
On Tue, Oct 2, 2012 at 4:40 AM, Eric Chen eric.chenchao@gmail.com wrote:
Have you tried hook_node_load()?
Cheers, Eric
On Tue, Oct 2, 2012 at 11:42 AM, Ms. Nancy Wichmann nan_wich@bellsouth.net wrote:
How about hook_node_view_alter()? I've never tried it, but I'd really
think
hook_node_view() would be the right place. There are also some field and entity hooks that fire before that.
Nancy Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L.
King,
Jr.
From: toon severijns This must be a simple thing to do but i can't seem to get my head around
it:
I have got a content type 'publication' A publication can have two possible physical formats: "normal",
"electronic"
When a publication has physical format "electronic" i'd like to alter my title field in al my view modes (i use display suite) like this "Some
Title
(electronic)"
I've been trying theme_preprocess_node function but to no avail. I've also tried hook_node_view, but there i have my title field already
as
markup in an array so i can't just alter the title itsself.
-- [ Drupal support list | http://lists.drupal.org/ ]
-- [ Drupal support list | http://lists.drupal.org/ ]