Сохраняет новую форму

@return string

@since 1.01
186654
private function actionCreate()
    {
        $forms = $this->plugin->getForms();
        $name = arg('name');
        if ($forms->get($name) === false)
        {
            $forms->add($name, arg('code'), arg('title'));
            HTTP::redirect(arg('submitURL'));
        }
        ErrorMessage('Форма с таким именем уже есть! Укажите другое имя.');
        return $this->actionAddDialog();
    }
1012019
public function updateFileInfo()
    {
        $src = $this->src;

        if ($this->cluster instanceof ClusterLocal) {
            if (!\Yii::$app->request->hostInfo) {
                return $this;
            }

            $src = \Yii::$app->request->hostInfo . $this->src;
        }
        //Елси это изображение
        if ($this->isImage()) {
            if (extension_loaded('gd')) {
                list($width, $height, $type, $attr) = getimagesize($src);
                $this->image_height = $height;
                $this->image_width = $width;
            }
        }

        $this->save();
        return $this;
    }
978428
protected function getFileName(): string
    {
        if ($this->generatedFileName === null || Application::isCli()) {
            if ($this->fileNameFn !== null) {
                $this->generatedFileName = call_user_func($this->fileNameFn);
            } else {
                $this->generatedFileName = gmdate('Y-m-d') . '.log';
            }
        }

        return $this->generatedFileName;
    }
28853
private function filename()
    {
        $to = str_replace(['@', '.'], ['_at_', '_'], array_keys($this->message->getTo())[0]);

        return str_slug($this->message->getDate().'_'.$to.'_'.$this->message->getSubject(), '_').'.html';
    }
873421
public function getCreateUrl()
    {
        $queryString = '';

        if ($constraints = $this->model()->getConstraints()) {
            $queryString = http_build_query($constraints);
        }

        return sprintf('%s/create%s',
            $this->resource(),
            $queryString ? ('?'.$queryString) : ''
        );
    }
182644
private function actionUpdate()
    {
        $oldName = arg('update');
        $newName = arg('name');
        $forms = $this->plugin->getForms();
        if ($oldName == $newName || $forms->get($newName) === false)
        {
            $forms->update($oldName, arg('code'), arg('title'));

            $url = arg('submitURL');
            if ($oldName != $newName)
            {
                $forms->rename($oldName, $newName);
                $url = str_replace('edit=' . $oldName, 'edit=' . $newName, $url);
            }
            HTTP::redirect($url);
        }
        ErrorMessage('Форма с таким именем уже есть! Укажите другое имя.');
        return $this->actionEditDialog($oldName);
    }
505179
public static function current() {

		$title = '';

		if ( is_front_page() ) {
			$title = static::frontPage();

		} elseif ( is_home() || is_singular() ) {
			$title = static::post();

		} elseif ( is_archive() ) {
			$title = static::archive();

		} elseif ( is_search() ) {
			$title = static::search();

		} elseif ( is_404() ) {
			$title = static::error();
		}

		return $title;
	}
1286682
public function forTemplate()
	{
		$this->Fields()->bootstrapify();
		$this->Actions()->bootstrapify();
		Requirements::css(FOUNDATIONFORMS_DIR . '/css/foundationforms.css');

		return parent::forTemplate();
	}
1331918
public function getThumbnailEncoded()
    {
        if ($data = base64_decode($this->getThumbnail(), $strict = true)) {
            // In case we don't have the file info extension enabled,
            // we'll set the jpeg mime type as default.
            $mime = 'image/jpeg';

            $image = base64_encode($data);

            if (function_exists('finfo_open')) {
                $finfo = finfo_open();

                $mime = finfo_buffer($finfo, $data, FILEINFO_MIME_TYPE);

                return "data:$mime;base64,$image";
            }

            return "data:$mime;base64,$image";
        }
    }
1277434
final public function getNewFileName()
    {
        if (null === $this->_newFileName) {
            if (isset($this->uploaded['name'])) {
                $this->_newFileName = NamesHelper::transliterate($this->uploaded['name'], true);
            }
        }
        return $this->_newFileName;
    }
632328
protected function generateErrorMessage(): string
    {
        switch ($this->type) {
            case 'image/png':
                $readableType = _('PNGファイル');
                break;
            case 'image/jpeg':
                $readableType = _('JFIF (JPEG) ファイル');
                break;
            case 'image/svg+xml':
                $readableType = _('SVGファイル');
                break;
        }
        return sprintf(_('「%1$s」は妥当な%2$sではありません。'), $this->filename, $readableType);
    }
740946
public function actionCreate()
    {
        $request = Yii::$app->request;
        $model = new Gallery();

        if ($request->isAjax) {
            /*
            *   Process for ajax request
            */
            Yii::$app->response->format = Response::FORMAT_JSON;
            if ($request->isGet) {
                return [
                    'title' => "Create Gallery",
                    'content' => $this->renderPartial('create', [
                        'model' => $model,
                    ]),
                ];
            } else if ($model->load($request->post()) && $model->validate()) {
                $model->name = Html::encode($model->name);
                $model->date = date('Y-m-d H:i:s');
                if($model->save()) {
                    $alias = Yii::getAlias('@app/web/img/gallery/' . Translator::rus2translit($model->name));
                    try {
                        //если создавать рекурсивно, то работает через раз хз почему.
                        $old = umask(0);
                        mkdir($alias, 0777, true);
                        chmod($alias, 0777);
                        mkdir($alias . '/thumb', 0777);
                        chmod($alias . '/thumb', 0777);
                        umask($old);
                    } catch (\Exception $e){
                        return('Не удалось создать директорию ' . $alias . ' - ' . $e->getMessage());
                    }
                    return [
                        'forceReload' => true,
                        'forceClose' => true,
                        'hideActionButton' => true,
                        'title' => "Create Gallery",
                        'content' => '<span class="text-success">Success!</span>'
                    ];
                } else{
                    return [
                        'title' => "Create Gallery",
                        'content' => $this->renderPartial('create', [
                            'model' => $model,
                        ]),
                    ];
                }
            } else {
                return [
                    'title' => "Create Gallery",
                    'content' => $this->renderPartial('create', [
                        'model' => $model,
                    ]),
                ];
            }
        } else {
            /*
            *   Process for non-ajax request
            */
            if ($model->load($request->post()) && $model->save()) {
                return $this->redirect(['view', 'id' => $model->gallery_id]);
            } else {
                return $this->render('create', [
                    'model' => $model,
                ]);
            }
        }

    }
612382
public function getFormUrl()
    {
        $this->_initOrder();
        $order = $this->_order;
        $payment = $order->getPayment();
        return $payment->getAdditionalInformation('issuerUrl');
    }
263657
public function getSentMIMEMessage()
    {
        return rtrim($this->MIMEHeader . $this->mailHeader, "\n\r") . self::CRLF . self::CRLF . $this->MIMEBody;
    }
132637
public function getExpression()
    {
        return \sprintf('%s %s %s %s %s', $this->minute, $this->hour, $this->dayOfMonth, $this->month, $this->dayOfWeek);
    }
693242
public function forTemplate()
    {
        $isEditable = FrontendEditing::editingEnabled() && FrontendEditing::isEditable($this);
        $value      = parent::forTemplate();
        if ($isEditable) {
            $field = $this->formField(null, null, false, $value)->
                setAttribute('data-feclass', FrontendEditing::getClassName($this))->
                setAttribute('data-feid', FrontendEditing::getID($this))->
                setAttribute('data-fefield', $this->name)->
                addExtraClass("frontend-editable frontend-editable-enum");
            $value = $field->forTemplate();
        }
        return $value;
    }
961782
public function generate()
    {
        $return = '';

        if (empty($this->thumbnailSize)) {
            $this->thumbnailSize = [
                Config::get('imageWidth'),
                Config::get('imageHeight'),
                'box',
            ];
        }

        $file = FilesModel::findByPk($this->varValue);
        if (null === $file && null !== $this->fallbackImage) {
            $file = FilesModel::findByPk($this->fallbackImage);
        }
        if (null !== $file) {
            $altTag = $file->name;
            $size   = deserialize($this->thumbnailSize);
            $image  = Image::create($file->path, $size)->executeResize();

            $return .= sprintf(
                '<img src="%s" width="%s" height="%s" alt="%s" class="uploaded-image">',
                $image->getResizedPath(),
                $image->getTargetWidth(),
                $image->getTargetHeight(),
                $altTag
            );
        }

        if ($this->addMetaWizard) {
//@todo add meta wizard here
        }

        $return .= parent::generate();

        if ($this->enableReset) {
            $return .= sprintf(
                '<input type="checkbox" name="%s" class="checkbox" value=""><label>%s</label> ',
                $this->strName.'_reset',
                'Reset'
            );
        }

        return $return;
    }