public function defaultFilters($filters = [])
    {
        if (empty($filters)) {
            return false;
        }
        foreach ($filters as $key => $value) {
            $filterName = 'Filter-' . str_replace('.', '-', $key);
            $explodedFilterName = explode('-', $filterName);
            if (count($explodedFilterName) !== 3) {
                return false;
            }
            if (empty($this->_controller->request->query[$filterName])) {
                // set request POST data so the inputs will be filled
                $this->_controller->request->data[$explodedFilterName[0]][$explodedFilterName[1]][$explodedFilterName[2]] = $value;
                $this->_controller->paginate['conditions'][$key] = $value;
            } elseif ($this->_controller->request->query[$filterName] == 'all') {
                unset($this->_controller->request->data[$explodedFilterName[0]][$explodedFilterName[1]][$explodedFilterName[2]]);
                unset($this->_controller->paginate['conditions'][$key]);
            }
        }

        return true;
    }
public function defaultFilters($filters = [])
    {
        if (empty($filters)) {
            return false;
        }
        foreach ($filters as $key => $value) {
            $filterName = 'Filter-' . str_replace('.', '-', $key);
            $explodedFilterName = explode('-', $filterName);
            if (count($explodedFilterName) !== 3) {
                return false;
            }
            if (empty($this->_controller->request->query[$filterName])) {
                // set request POST data so the inputs will be filled
                $this->_controller->request->data[$explodedFilterName[0]][$explodedFilterName[1]][$explodedFilterName[2]] = $value;
                $this->_controller->paginate['conditions'][$key] = $value;
            } elseif ($this->_controller->request->query[$filterName] == 'all') {
                unset($this->_controller->request->data[$explodedFilterName[0]][$explodedFilterName[1]][$explodedFilterName[2]]);
                unset($this->_controller->paginate['conditions'][$key]);
            }
        }

        return true;
    }
public function defaultFilters ( $ filters = [ ] ) { if ( empty ( $ filters ) ) { return false ; } foreach ( $ filters as $ key => $ value ) { $ filterName = 'Filter-' . str_replace ( '.' , '-' , $ key ) ; $ explodedFilterName = explode ( '-' , $ filterName ) ; if ( count ( $ explodedFilterName ) !== 3 ) { return false ; } if ( empty ( $ this -> _controller -> request -> query [ $ filterName ] ) ) { // set request POST data so the inputs will be filled $ this -> _controller -> request -> data [ $ explodedFilterName [ 0 ] ] [ $ explodedFilterName [ 1 ] ] [ $ explodedFilterName [ 2 ] ] = $ value ; $ this -> _controller -> paginate [ 'conditions' ] [ $ key ] = $ value ; } elseif ( $ this -> _controller -> request -> query [ $ filterName ] == 'all' ) { unset ( $ this -> _controller -> request -> data [ $ explodedFilterName [ 0 ] ] [ $ explodedFilterName [ 1 ] ] [ $ explodedFilterName [ 2 ] ] ) ; unset ( $ this -> _controller -> paginate [ 'conditions' ] [ $ key ] ) ; } } return true ; }
Set fields given as keys in FilterList and paginator conditions to given values if not set by URL.

To reset a default value (normally the empty option), an option with key 'all' must be selected.
To imitate the behaviour of empty, set empty in inputOptions to false and add ['all' => ''] to options

Array syntax of $filters has to be:
[
'{$Tables}.{$field}' => {$defaultValue}
]

@param  array  $filters array of fields and their default values like described above
@return bool   false if anything goes wrong, else true
Set fields given as keys in FilterList and paginator conditions to given values if not set by URL .