How to override filter operators?

How to override filter operators?

Like removing in the Date Created and Date Modified the Select dropdown 'before' 'after' 'yesterday'.. and so on

I already edited and created file in /custom/modules/Cases/clients/base/filters/operators/operators.php

but doesnt seem to work..

  • Hi Longki,

    I don’t think extending filters operators to custom module specific will work.

    I mean like

    /custom/modules/Cases/clients/base/filters/operators/operators.php

    But you can achieve it by extending that to custom .like

    /custom/clients/base/filters/operators/operators.php

    You should include core operators.php to custom.like below

    require_once('clients/base/filters/operators/operators.php');

    Here you can try adding/removing your code.It will work.

    Note: Whatever you are doing inside custom/clients/ ,it will be applicable for all sidecar modules.Let say you are removing (yesterday,today,tomorrow) in date field .you can't find these three in any of sidecar module filter.

    Thanks!.

  • i was restricted to the override the search operator for the Cases modules only.. how can i achiece this? is this possible?

  • In my knowledge No.We cant make it work only for specific module.Let me add few more points to this.

    But if you try printing that $viewdefs from /custom/modules/cases/clients/base/filters/operators/operators.php to sugar log.

    It is giving updated viewdef array.Which means our file is executing.But No idea about why it is not effecting in layout.Executing order also proper.Sugar it is executing clients/base/filters code then /custom/modules/cases/clients/base/filters/operators/operators.php. you can confirm in printed viewdef array in log.In that viewdef array, First it will be having array content of client/base/filter and next our custom code(/custom/modules/cases/clients/base/filters/operators/operators.php) .No change in that.