lib/components/web/form/Generator.php
public function generate()
    {
        if (empty($this->_items)) {
            return '';
        }
        $result = [];
        $formOptions = [
            'options' => ['class' => ''], //form-horizontal
            'enableClientValidation' => false,
        ];
        if (Yii::$app->request->isAjax) {
            Html::addCssClass($formOptions['options'], 'ajax');
        }

        if ($this->hasFile() && !isset($formOptions['options']['enctype'])) {
            $formOptions['options']['enctype'] = 'multipart/form-data';
        }

        list($this->form, $formStartRow) = ActiveForm::begin($formOptions, false);
        $result[] = $formStartRow;
        // $result[] = Html::beginForm('', 'post', array('class' => $this->class));
        $result[] = Html::beginTag('div', ['class' => '']);
        foreach ($this->_items as $item) {
            $result[] = $item->generate();
        }
        //if (!Yii::$app->request->isAjax) {
            $result[] = Html::beginTag('div', ['class' => 'row form-group submit-group']);
        $result[] = Html::beginTag('div', ['class' => 'col-sm-12']);
        $result[] = Html::submitButton('Save', ['class' => 'btn btn-primary']);
        $result[] = Html::endTag('div');
        $result[] = Html::endTag('div');
        //}
        $result[] = Html::endTag('div');
        $result[] = ActiveForm::end(false);

        return implode("\n", $result);
    }
public function generate()
    {
        if (empty($this->_items)) {
            return '';
        }
        $result = [];
        $formOptions = [
            'options' => ['class' => ''], //form-horizontal
            'enableClientValidation' => false,
        ];
        if (Yii::$app->request->isAjax) {
            Html::addCssClass($formOptions['options'], 'ajax');
        }

        if ($this->hasFile() && !isset($formOptions['options']['enctype'])) {
            $formOptions['options']['enctype'] = 'multipart/form-data';
        }

        list($this->form, $formStartRow) = ActiveForm::begin($formOptions, false);
        $result[] = $formStartRow;
        // $result[] = Html::beginForm('', 'post', array('class' => $this->class));
        $result[] = Html::beginTag('div', ['class' => '']);
        foreach ($this->_items as $item) {
            $result[] = $item->generate();
        }
        //if (!Yii::$app->request->isAjax) {
            $result[] = Html::beginTag('div', ['class' => 'row form-group submit-group']);
        $result[] = Html::beginTag('div', ['class' => 'col-sm-12']);
        $result[] = Html::submitButton('Save', ['class' => 'btn btn-primary']);
        $result[] = Html::endTag('div');
        $result[] = Html::endTag('div');
        //}
        $result[] = Html::endTag('div');
        $result[] = ActiveForm::end(false);

        return implode("\n", $result);
    }
[[@doctodo method_description:generate]].

@return unknown