/** * Return the default sort rule for the query * * @param string $column An optional column * * @return array An array of two values: $column, $direction */ protected function getSortDefaults($column = null) { $direction = null; if ($this->query !== null && $this->query instanceof SortRules) { $sortRules = $this->query->getSortRules(); if ($column === null) { $column = key($sortRules); } if ($column !== null && isset($sortRules[$column]['order'])) { $direction = strtoupper($sortRules[$column]['order']) === Sortable::SORT_DESC ? 'desc' : 'asc'; } } return array($column, $direction); }