Pagekit\Dashboard\Controller\DashboardController::reorderAction PHP Method

reorderAction() public method

public reorderAction ( $order = [] )
    public function reorderAction($order = [])
    {
        $widgets = $this->dashboard->getWidgets();
        $reordered = [];
        foreach ($order as $id) {
            if ($widget = $this->dashboard->getWidget($id)) {
                $reordered[$id] = $widget;
            }
        }
        if (count($widgets) == count($reordered)) {
            $this->dashboard->saveWidgets($reordered);
        }
        return ['message' => __('Widgets reordered.')];
    }