lib/controllers/ObjectController.php
public function actionWidget()
    {
        $package = [];
        $renderWidgets = [];
        if (!empty($_POST['widgets'])) {
            $renderWidgets = $_POST['widgets'];
            $baseState = ['fetch' => 0];
        } elseif (!empty($_GET['widgets'])) {
            $renderWidgets = $_GET['widgets'];
            $baseState = ['fetch' => 1];
            ob_start();
            ob_implicit_flush(false);
        }
        $sectionCount = count($renderWidgets);
        if (isset($_GET['sectionCount'])) {
            $sectionCount = (int) $_GET['sectionCount'];
        }
        if (isset($_POST['sectionCount'])) {
            $sectionCount = (int) $_POST['sectionCount'];
        }
        if (!empty($renderWidgets)) {
            foreach ($renderWidgets as $i => $widget) {
                $w = [];
                if (empty($widget['state'])) {
                    $widget['state'] = [];
                }
                if (empty($widget['data'])) {
                    $widget['data'] = [];
                }
                if (!isset($widget['data']['sectionCount'])) {
                    $widget['data']['sectionCount'] = $sectionCount;
                }
                $w['rendered'] = Yii::$app->widgetEngine->build($widget['name'], $widget['data'], [], array_merge($baseState, $widget['state']));
                $w['id'] =  Yii::$app->widgetEngine->lastBuildId;
                $package[$i] = $w;
            }
        }
        //sleep(3);
        $this->params['widgets'] = $package;
        //var_dump($package);exit;
        $this->json();
    }
public function actionWidget()
    {
        $package = [];
        $renderWidgets = [];
        if (!empty($_POST['widgets'])) {
            $renderWidgets = $_POST['widgets'];
            $baseState = ['fetch' => 0];
        } elseif (!empty($_GET['widgets'])) {
            $renderWidgets = $_GET['widgets'];
            $baseState = ['fetch' => 1];
            ob_start();
            ob_implicit_flush(false);
        }
        $sectionCount = count($renderWidgets);
        if (isset($_GET['sectionCount'])) {
            $sectionCount = (int) $_GET['sectionCount'];
        }
        if (isset($_POST['sectionCount'])) {
            $sectionCount = (int) $_POST['sectionCount'];
        }
        if (!empty($renderWidgets)) {
            foreach ($renderWidgets as $i => $widget) {
                $w = [];
                if (empty($widget['state'])) {
                    $widget['state'] = [];
                }
                if (empty($widget['data'])) {
                    $widget['data'] = [];
                }
                if (!isset($widget['data']['sectionCount'])) {
                    $widget['data']['sectionCount'] = $sectionCount;
                }
                $w['rendered'] = Yii::$app->widgetEngine->build($widget['name'], $widget['data'], [], array_merge($baseState, $widget['state']));
                $w['id'] =  Yii::$app->widgetEngine->lastBuildId;
                $package[$i] = $w;
            }
        }
        //sleep(3);
        $this->params['widgets'] = $package;
        //var_dump($package);exit;
        $this->json();
    }
[[@doctodo method_description:actionWidget]].