Computed Field allows one to write the logic in a module file instead of saving PHP directly in the database. Would you be willing to implement something like this in Views PHP? It would make the PHP in fields easier to maintain for many developer-level users (and I think most users are developers).
The idea is that I'd define a function like
function MODULENAME_views_php_field_VIEWNAME_DISPLAYNAME_FIELDNAME($view, $row);
// Some code
}
that it will be run instead of whatever's in the text area.
_field
could be replaced by _filter
, _access
, _cache
where appropriate as well. DISPLAYNAME could be optional and take precedence over the non-DISPLAYNAME version.
Really, even a basic form of this would be awesome. Hope you like the idea.
Comments
Comment #1
casey CreditAttribution: casey commentedImplementing your own handler would be more advisable, but I understand a feature like this demands less knowledge of the inner working of views.
Patches are welcome. I don't have time to review though.
Comment #2
Liam MorlandComment #3
colanUpdate: In the new major version, Computed Field no longer allows code in the DB at all. It can only be entered via code in modules. For security reasons, it would be great if this module started moving in that direction too. For more information, see #3143854: Stop allowing PHP from being entered on the Web UI.
Comment #4
Liam MorlandThis module will probably have no further development except bug fixes in 7.x-1.x.