Closed (fixed)
Project:
Views (for Drupal 7)
Version:
7.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
2 Nov 2011 at 13:54 UTC
Updated:
2 Jun 2012 at 19:53 UTC
On 7.3.0-rc1 I can set the title of a page using a PHP field with this little snippet: drupal_set_title($title = $row->title)
On 7.x-3.x-dev this doesn't work.
I'm not sure if this is a bug or if something has changed...
If things have changed can anyone tell me how we can achieve this?
Comments
Comment #1
dawehnerIt's by design. If you want to change the title you should do it after generating the view, because views has to set it, too.
Comment #2
aristeides commentedDereine I know you're really busy and I 'm always surprised to see you're the one answering almost all the issues here. But could you (or someone else) provide an alternative?
does that mean I'd have to create a custom module just for this function?
Do you know if it's in the roadmap making the title fieldable? or perhaps make it accept tokens? It would solve problems we 've always adressed using the views_php module and writing snippets... but since this is now not doable we should have another way to do it.
Comment #3
dawehnerYou should checkout the latest dev. Views has support for tokens in the title.
Comment #4
aristeides commentedWow, thanks... marking as closed.
Comment #5
kyle_mathews commentedFor those still wanting to change their View title in code, this is what I figured out will work in the latest release.
I was using hook_views_pre_render() -- that doesn't work anymore.
But take your same code and switch to use hook_views_post_render and make it look something like:
Comment #6
scotwith1tNICE! Thanks.
Comment #7
hyperglide commentedI believe I am trying to accomplish the same thing as noted in this issues #1602058: How to set the Page Title In Views (PageTile 7.x-2.7 and Views 7.x-3.7).
is this the solution any way to do without custom code per view?
Ty
Comment #8
scotwith1tdawehner mentioned above that the latest dev supports tokens for the title, but i haven't tried that out...otherwise, this is a pretty simple custom code to stick in a module...