Closed (fixed)
Project:
Views (for Drupal 7)
Version:
6.x-2.9
Component:
Miscellaneous
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
27 Sep 2010 at 00:04 UTC
Updated:
2 Feb 2012 at 15:23 UTC
Hi,
I'm doing argument validation with PHP in my view. All what I need is working, but I don't know, how I can set the page title there. When I dump the $view variable, so I get a big output and I cannot search there for the right array-key to modify. Firefox and Safari are crashing, when I'm loading the page with the dump. Has anyone an idea?
Comments
Comment #1
dawehnerTo look at a view variable dpm($view) (part of the devel module) is recommended.
You could manipulate the title by setting $view->build_info['title']
Comment #2
merlinofchaos commentedYou can also set, I think it's $agument->validated_title out of the validator, and that will set the title that will be used in substitutions. i.e, normally if you have a Node: Nid arg as the first argument, %1 will be replaced by the title of the node.
Comment #3
jepster_Hi,
thanks for your fast reply. $view->build_info['title'] and $argument->validated_title aren't working. I've solved it by redirecting the user with php's own method:
header("Status: 301 Moved Permanently");
header("Location:https://test.not-a-domain/no-authorization");
exit;
Comment #5
planctus commentedI'm t trying to set the title for a page display through the argument validation...
In my situation the argument is a date field, my problem is that it is always showing a title where date granularity is 'day'.
I think it does this way since the argument settings for granularity is 'day', indeed.
But when i'm showing a "month" view that title doesn't make any sense, i've tried both method suggested here, i also changed the value for the argument granularity inside the $view object in that case using 'month', so that the title generated would reflect the change but nothing worked.
Is there any chance to do this?
Comment #6
jacktonkin commentedSet
$handler->validated_titlein the validator to set the argument title as described in #2 above. This works for me in 6.x-2.16.Comment #7
planctus commentedI suppose i had already tried that solution when i wrote this...
Don't remember exactly, but what i'm using now is something like this:
$view->display['display_id']->handler->handlers['argument']['field_nameofthefield']->options['title']That way it is working...
Thanks,
Da.