Skip to main content
1 of 3
Letharion
  • 27.5k
  • 11
  • 83
  • 141

Add condition group in Views filter handler

I have a Views filter handler, which does

$this->query->add_where(
  $this->options['group'],
  $this->real_field,
  vms_get_current_mlid(),
  $this->operator = ($this->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.

How do I do that?

Letharion
  • 27.5k
  • 11
  • 83
  • 141