Field not shown in views_get_view()

timmillwood - July 16, 2009 - 13:48
Project:Views Custom Field
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:active
Description

When running the code...

<pre>
<?php
$view
= views_get_view(allposts);
$view->execute();
print_r($view->result);
?>

</pre>

The result from the views custom field is not shown.

#1

BWPanda - September 28, 2009 - 23:03
Component:User interface» Code

Apparently this issue is also causing the problem in this issue: #573390: Custom text values don't work
Any update on this?

#2

kratib - October 8, 2009 - 18:34

Instead of calling $view->execute(), call $view->render(). The $view->result array should be updated then. The problem is that Views does not have a post-execute hook where VCF would be able to compute the field values. Hence, this computation can only occur at pre-render time.

Note that this technique currently works only for the PHP Custom Field. If you report that it works well, I can extend it to Markup and Rownumber.

 
 

Drupal is a registered trademark of Dries Buytaert.