I would very much like a way to fall back, on an ad-hoc basis, to PHP for the query portion of a view if the standard model is too restrictive, yet still use the views rendering functionality (eg, configurable multiple displays, styles, etc.)

Comments

rprogrammer’s picture

Priority: Critical » Normal
merlinofchaos’s picture

It would be nice, but it's surprisingly difficult to do that, because the query generator relies on controlling the aliases.

merlinofchaos’s picture

Probably your best way to do this would be to create a custom filter that adds whatever filters you need, it can be a giant OR or whatever. That way the rest of the query is still generated by Views.

rprogrammer’s picture

I tried to make a custom filter, but I got the impression from the docs that you couldn't project a filter onto pre-existing tables, only define filters for your module's own tables.

merlinofchaos’s picture

You can add filters to existing tables via hook_views_datal_alter()

merlinofchaos’s picture

Only you need to spell the hook correctly, unlike my version above. :P

esmerel’s picture

Status: Active » Closed (fixed)