It's not possible to just check if a query has a field (disregarding its value).

Comments

damien tournoud’s picture

Status: Active » Needs review
StatusFileSize
new791 bytes

Here is a trivial patch.

JacobSingh’s picture

I'm a little confused how this will work

So you pass in null.

You are looking for a field which is defined, but which has a null value

You want the function to return true.

if (!empty($values['#name']) && !empty($values['#value']) && ...

Isn't the $values['#value'] part always going to be empty if the field is set to null? Which means this will never return true?

This must eval to true for it to return true.

I'm sure you got this working before you sent the patch, so I must be missing something, but that's what I see here.

pwolanin’s picture

I dobn't htink this is intended to support empty values - the idea is to check whether there are any filters currently on a given field.

robertdouglass’s picture

Status: Needs review » Closed (won't fix)