GridFieldOrderableRows::getManipulatedData PHP Method

getManipulatedData() public method

public getManipulatedData ( GridField $grid, SS_List $list )
$grid GridField
$list SS_List
    public function getManipulatedData(GridField $grid, SS_List $list)
    {
        $state = $grid->getState();
        $sorted = (bool) (string) $state->GridFieldSortableHeader->SortColumn;
        // If the data has not been sorted by the user, then sort it by the
        // sort column, otherwise disable reordering.
        $state->GridFieldOrderableRows->enabled = !$sorted;
        if (!$sorted) {
            $sortterm = '';
            if ($this->extraSortFields) {
                if (is_array($this->extraSortFields)) {
                    foreach ($this->extraSortFields as $col => $dir) {
                        $sortterm .= "{$col} {$dir}, ";
                    }
                } else {
                    $sortterm = $this->extraSortFields . ', ';
                }
            }
            if ($list instanceof ArrayList) {
                // Fix bug in 3.1.3+ where ArrayList doesn't account for quotes
                $sortterm .= $this->getSortTable($list) . '.' . $this->getSortField();
            } else {
                $sortterm .= '"' . $this->getSortTable($list) . '"."' . $this->getSortField() . '"';
            }
            return $list->sort($sortterm);
        } else {
            return $list;
        }
    }