I think it would be useful if you add to the description
of the value field how to get views arguments
in addition to $data and $static variables.

Something like:

$view = views_get_current_view();
$view_args = $view->args;

Comments

ericpai’s picture

I'd like to know this also.

d0ublej0’s picture

Issue tags: +args
StatusFileSize
new1.49 KB

This module doesn't support to access any other variables in the custom php code then $data and $static; I've modified the views_customfield_handler_field_phpcode.php (ref attached patch) and it's working fine ;)

newsoul_br’s picture

Man ! You saved my life !

Thanks a lot !

ambereyes’s picture

Status: Active » Reviewed & tested by the community

This patch adds a $args array which is freaking brilliant!

And I think it should be added to the project.

My 0.2 cents!

capellic’s picture

Indeed -- this should certainly be the module.

YK85’s picture

subscribing

socialform’s picture

I think this patch allows me to do what I want... which is do something with the args.

I'd like to highlight a row (via inline CSS) if the row's nid matches the argument nid.

Basically, i have an global:null argument (so the argument is ignored and all nodes are shown) passing a nid argument to the view.

Can anyone suggest some php that would print inline css if the row's nid matches the argument? Thanks.

{edit}
ok figured it out...
if ($args[0] == $data->nid) print 'some css';

thanks for the patch and module!

savedario’s picture

Thanks for the patch.

I was wondering... did this ever make it to the official release or is it still only in dev ?

marko b’s picture

Also wondering will this be in some release? This is very useful.

icanko’s picture

This patch is 1 year 9 months and 12 days old yet it isn't added neither to dev 6.x, neither to the new Views PHP module for Drupal 7. Any ideas why?

EDIT:
I answered my own question in an issue for Views PHP - http://drupal.org/node/1352728#comment-6287060 .
Although the functionality is already there, I think this patch is useful in that it adds information to the "Available variables" section.

jvieille’s picture

Issue summary: View changes

Many Thanks!