I just made a view with some filters (date), I wonder how can I choose the operator to mix the options "Less than or equal" and NULL, in just one request? I can't do that with "Grouped filters", Should I hook the code? If that's so, where?

Thanks so much


Well I could figured out this for myself, if anyone need it here is what you need to do:

  1. Go to sites/all/modules/views/handlers/views_handler_filter_numeric.inc

  2. In there:

    a. Inside the function operators()->$operators = array(


    'custom' => array(
    'title' => t('Title you want for your operator'),
        'method' => 'op_custom',
        'short' => t('<='),
        'values' => 1,

c. Then around line 255 or so create a new function:

function op_custom($field) {
  $or = db_or()
  ->condition($field, $this->value['value'], 'IS NULL')
  ->condition($field, $this->value['value'], '<=');

And you can choose that operator now in your Data Filter.

I hope this helps, any questions let me know as PM or comments, take care

| improve this answer | |
  • Just wanted to note that it isn't recommended to hack modules. Better to create a new module that contains a custom handler. – othermachines Aug 13 '15 at 0:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.