In our use case we need to know the filter that was set on the view in order to do more processing in a PHP type field. This patch adds the $view object to the eval so that information about the view can be access.

If you care, after applying this patch the view's filter can be access in $view->exposed_data

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

DarrellDuane’s picture

Status: Needs review » Reviewed & tested by the community

This is a huge help! thanks harking

I use $view->args to get the argument to the view
and $view->result to get access to other rows' data for doing comparisions/calculations. Thanks for this patch.
It works well for me.

syakely’s picture

Big Help, exactly what I needed.

One suggestion to the patch. Add in

.t('$view: contains the $view data (e.g. $view->exposed_data).')

to the function options_form(&$form, &$form_state).

Thanks!!

skylord’s picture

Patch works OK! Plz, commit it to the main branch....

DarrellDuane’s picture

great idea syakely! Lets get this in the main branch!

jstoller’s picture

I'm not entirely sure this patch is necessary. It doesn't seem to be well documented, but you should be able to access the view object in your custom field in $this->view

casey’s picture

I added this to the D7 version: http://drupal.org/project/views_php

Please help me test it.

YK85’s picture

subscribing