public function setSort($sort = null)
    {
        $sort = $sort && is_array($sort) ? $sort : $this->config->getOption('sort');

        //set the sort values
        $this->sort = array(
            'field'     => isset($sort['field']) ? $sort['field'] : $this->config->getDataModel()->getKeyName(),
            'direction' => isset($sort['direction']) ? $sort['direction'] : 'desc',
        );

        //if the sort direction isn't valid, set it to 'desc'
        if (!in_array($this->sort['direction'], array('asc', 'desc'))) {
            $this->sort['direction'] = 'desc';
        }
    }
public function setSort($sort = null)
    {
        $sort = $sort && is_array($sort) ? $sort : $this->config->getOption('sort');

        //set the sort values
        $this->sort = array(
            'field'     => isset($sort['field']) ? $sort['field'] : $this->config->getDataModel()->getKeyName(),
            'direction' => isset($sort['direction']) ? $sort['direction'] : 'desc',
        );

        //if the sort direction isn't valid, set it to 'desc'
        if (!in_array($this->sort['direction'], array('asc', 'desc'))) {
            $this->sort['direction'] = 'desc';
        }
    }
public function setSort ( $ sort = null ) { $ sort = $ sort && is_array ( $ sort ) ? $ sort : $ this -> config -> getOption ( 'sort' ) ; //set the sort values $ this -> sort = array ( 'field' => isset ( $ sort [ 'field' ] ) ? $ sort [ 'field' ] : $ this -> config -> getDataModel ( ) -> getKeyName ( ) , 'direction' => isset ( $ sort [ 'direction' ] ) ? $ sort [ 'direction' ] : 'desc' , ) ; //if the sort direction isn't valid, set it to 'desc' if ( ! in_array ( $ this -> sort [ 'direction' ] , array ( 'asc' , 'desc' ) ) ) { $ this -> sort [ 'direction' ] = 'desc' ; } }
Sets up the sort options.

@param array $sort
Sets up the sort options .