PodsUI::sort_data PHP Method

sort_data() public method

Sort out data alphabetically by a key
public sort_data ( )
    public function sort_data()
    {
        // only do this if we have a default orderby
        if (isset($this->orderby['default'])) {
            $orderby = $this->orderby['default'];
            foreach ($this->data as $k => $v) {
                $sorter[$k] = strtolower($v[$orderby]);
            }
            if ($this->orderby_dir == 'ASC') {
                asort($sorter);
            } else {
                arsort($sorter);
            }
            foreach ($sorter as $key => $val) {
                $intermediary[] = $this->data[$key];
            }
            if (isset($intermediary)) {
                $this->data = $intermediary;
                $this->data_keys = array_keys($this->data);
            }
        }
    }