Admin_PortalController::addWidgetAction PHP Метод

addWidgetAction() публичный Метод

public addWidgetAction ( )
    public function addWidgetAction()
    {
        $config = $this->getCurrentConfiguration();
        $nextId = 0;
        foreach ($config['positions'] as $col) {
            foreach ($col as $row) {
                $nextId = $row['id'] > $nextId ? $row['id'] : $nextId;
            }
        }
        $nextId = $nextId + 1;
        $config["positions"][0][] = ["id" => $nextId, "type" => $this->getParam("type"), "config" => null];
        $this->saveConfiguration($config);
        $this->_helper->json(["success" => true, "id" => $nextId]);
    }