[development] Views question

Earl Miles merlin at logrus.com
Fri Feb 17 15:23:34 UTC 2006


Simon Lindsay wrote:
> 
> I want to have a selectable field for the views module called "close" 
> that executes a function like this:
> 
> function job_close() {
>   $job = arg(2);
>   $sid = 15; // Should be configurable.
>   workflow_execute_transition($job, $sid);
>   drupal_goto('job/open');
> }
> 
> I've got it to work using the code below, but its not right. I shouldn't 
> have to use a valid field in the 'fields' section. This also means that 
> you can't have multiple versions, ie one to "approve", one to "close".
> 
> Anybody got any suggestions on a better way?

You don't have to.

You can do:

'fields' => array(
   'arbitrary_internal_name' => array(
     'name' => t("arbitrary_internal_name"),
     'notafield' => TRUE,
     // The below isn't even necessary if there is simply no field
     'field' => 'real_field' (OR) => array('real_field1', 'real_field2')
   ),
),

Is this what you want?


More information about the development mailing list