protected function _createSortFieldOption($field, $dir, $options)
    {
        $sortField = $this->sortFields[$field];
        if (isset($sortField['custom'])) {
            if (!is_array($sortField['custom'])) {
                $sortField['custom'] = [$sortField['custom']];
            }
            foreach ($sortField['custom'] as $sortEntry) {
                $options['order'][] = preg_replace('/:dir/', $dir, $sortEntry);
            }
        } else {
            $options['order'][] = $sortField['modelField'] . ' ' . $dir;
        }

        return $options;
    }
protected function _createSortFieldOption($field, $dir, $options)
    {
        $sortField = $this->sortFields[$field];
        if (isset($sortField['custom'])) {
            if (!is_array($sortField['custom'])) {
                $sortField['custom'] = [$sortField['custom']];
            }
            foreach ($sortField['custom'] as $sortEntry) {
                $options['order'][] = preg_replace('/:dir/', $dir, $sortEntry);
            }
        } else {
            $options['order'][] = $sortField['modelField'] . ' ' . $dir;
        }

        return $options;
    }
protected function _createSortFieldOption ( $ field , $ dir , $ options ) { $ sortField = $ this -> sortFields [ $ field ] ; if ( isset ( $ sortField [ 'custom' ] ) ) { if ( ! is_array ( $ sortField [ 'custom' ] ) ) { $ sortField [ 'custom' ] = [ $ sortField [ 'custom' ] ] ; } foreach ( $ sortField [ 'custom' ] as $ sortEntry ) { $ options [ 'order' ] [ ] = preg_replace ( '/:dir/' , $ dir , $ sortEntry ) ; } } else { $ options [ 'order' ] [ ] = $ sortField [ 'modelField' ] . ' ' . $ dir ; } return $ options ; }
Create the 'order' find condition part for a sorted field.

@param string $field The field name to sort
@param string $dir The sort direction (asc, desc)
@param array $options The current find options where the sorting should be added.
@return mixed
Create the order find condition part for a sorted field .