Add condition group in Views filter handler I have a Views filter handler, which does

$this-&gt;query-&gt;add_where(
  $this-&gt;options['group'],
  $this-&gt;real_field,
  vms_get_current_mlid(),
  $this-&gt;operator = ($this-&gt;operator == '=') ? 'IN' : 'NOT IN'
);


Which initially looks fine, but fails with "NOT IN", when the field value is NULL, as NOT IN (100) does not return TRUE for a NULL value, which is what I would like.

When the operator is 'NOT IN', I need to add a "OR IS NULL" operator as well, but still keep it within the same group.

If the filters are


  Node is "page" AND NID_REFERENCE NOT IN (100, 101, 102)


I would like that to become 


  Node is "page" AND (NID_REFERENCE NOT IN (100, 101, 102) OR NID_REFERENCE IS NOT NULL)


How do I do that?
The answer turns out to be that  add_where() also accepts a DatabaseCondition argument, meaning I could do

$this-&gt;query-&gt;add_where(
  $group,
  db_or()
    -&gt;condition($table, $vms_target, 'NOT IN')
    -&gt;condition($table, $vms_target, 'IS NULL')
)