Процесс отправки формы
@return array
2664
public function actionSubmit()
    {
        if (\Yii::$app->request->isAjax && !\Yii::$app->request->isPjax) {
            \Yii::$app->response->format = Response::FORMAT_JSON;

            $response = [
                'success' => false,
                'message' => 'Произошла ошибка',
            ];

            if (\Yii::$app->request->post('sx-model') && \Yii::$app->request->post('sx-model-value')) {
                $modelClass = \Yii::$app->request->post('sx-model');
                $modelValue = \Yii::$app->request->post('sx-model-value');
                /**
                 * @var RelatedElementModel $modelForm
                 */
                $modelForm = $modelClass::find()->where(['id' => $modelValue])->one();

                if (method_exists($modelForm, "createPropertiesValidateModel")) {
                    $validateModel = $modelForm->createPropertiesValidateModel();
                } else {
                    $validateModel = $modelForm->getRelatedPropertiesModel();
                }

                if ($validateModel->load(\Yii::$app->request->post()) && $validateModel->validate()) {
                    $validateModel->save();
                    $response['success'] = true;
                    $response['message'] = 'Успешно отправлена';

                } else {
                    $response['message'] = 'Форма заполнена неправильно';
                }

                return $response;
            }
        }
    }
39868
public function getData()
    {
        $data = [];

        $problems = $this->fetcher->fetch();

        $allowedSeverities = [
            Problem::SEVERITY_CRITICAL,
            Problem::SEVERITY_WARNING,
        ];

        foreach ($problems as $problem) {
            if (!in_array($problem->getSeverity(), $allowedSeverities)) {
                continue;
            }

            $data[] = [
                'id' => strlen($problem->getId()) ? $problem->getId() : md5(serialize($problem)),
                'iconCls' => $problem->getIconClass(),
                'severity' => $problem->getSeverity(),
                'msg' => $problem->getMessage(),
                'hint' => $problem->getHint(),
                'link' => $problem->getLink(),
            ];
        }

        if (!count($data)) {
            $data = false;
        }

        return $data;
    }
1257662
protected function getParametersFile()
    {
        $file_name = $this->appDir . '/config/' . self::PARAMETERS_FILE . '.php';
        if (!file_exists($file_name)) {
            return [];
        }

        if (null === $this->parameters) {
            foreach (require($file_name) as $k => $v) {
                $this->parameters["%{$k}%"] = $v;
            }
        }
        return $this->parameters;
    }
1079391
public function getCredentials()
    {
        $rc_file = $this->parse();
        if ( array_key_exists('username',$rc_file) && array_key_exists('username',$rc_file)) {
            return [$rc_file['username'],$rc_file['token']];
        }
    }
591996
public function collectCommonData()
    {
        /** @var OxpsPaymorrowSettings $oPmSettings */
        $oPmSettings = oxNew( 'OxpsPaymorrowSettings' );

        /** @var oxUser|OxpsPaymorrowOxUser $oUser */
        $oUser = $this->getUser();

        return array(
            'merchantId'           => $oPmSettings->getMerchantId(),
            'mpiSignature'         => $oPmSettings->getMpiSignature(),
            'request_languageCode' => $oUser->getUserPaymorrowRequestLanguage(),
            'request_id'           => $this->getUniqueString(),
        );
    }
870252
public function getMetas()
    {
        $ret = array();

        if (!isset($this->metas['title']) && $this->getParameter('nyroDev_utility.share.title')) {
            $this->setTitle($this->getParameter('nyroDev_utility.share.title'));
        }
        if (!isset($this->metas['description']) && $this->getParameter('nyroDev_utility.share.description')) {
            $this->setDescription($this->getParameter('nyroDev_utility.share.description'));
        }
        if (!isset($this->metas['keywords']) && $this->getParameter('nyroDev_utility.share.keywords')) {
            $this->set('keywords', $this->getParameter('nyroDev_utility.share.keywords'));
        }
        if (!isset($this->metasProp['og:image']) && $this->getParameter('nyroDev_utility.share.image')) {
            $this->setImage($this->getParameter('nyroDev_utility.share.image'));
        }

        if (isset($this->metas['title']) && $this->metas['title']) {
            $ret[] = '<title>'.$this->metas['title'].'</title>';
            unset($this->metas['title']);
        }

        foreach ($this->metas as $k => $v) {
            $ret[] = '<meta name="'.$k.'" content="'.str_replace('"', '&quot;', $v).'" />';
        }
        foreach ($this->metasProp as $k => $v) {
            $ret[] = '<meta property="'.$k.'" content="'.str_replace('"', '&quot;', $v).'" />';
        }

        return implode("\n", $ret);
    }
485585
public static function getAccept(): array
    {
        if (!self::$accept) {
            // get header from request
            self::$accept = self::parseAcceptHeader(self::getHeader('Accept'));
        }
        return self::$accept;
    }
137805
public function descriptions() {
    return [
      self::USER_VIEW => 'Просмотр пользователей',
      self::USER_CREATE => 'Добавление пользователей',
      self::USER_UPDATE => 'Редактирование пользователей',
      self::USER_CHANGE_SECURITY_INFO => 'Редактирование данных для входа',
      self::USER_CHANGE_PROFILE_INFO => 'Редактирование персональных данных',
    ];
  }
144624
public function getExportModes()
    {
        return array(
            'listAuthor' =>         ExportableField::LIST_OF
                                    + ExportableField::AUTHOR,
            'listAuthorObject' =>   ExportableField::LIST_OF
                                    + ExportableField::AUTHOR
                                    + ExportableField::OBJECT,
            'listAuthorToValue' =>  ExportableField::LIST_OF
                                    + ExportableField::AUTHOR
                                    + ExportableField::VALUE,
            'listValue' =>          ExportableField::LIST_OF
                                    + ExportableField::VALUE,
            'getPostdata' =>        ExportableField::POSTDATA
        );
    }
687199
public function toArray()
    {
        return [
            'id' => $this->id,
            'filename' => $this->filename,
            'filetype' => $this->filetype,
            'filesize' => $this->filesize,
            'tags' => $this->tags,
            'preview_url' => $this->previewUrl(),
            'url' => $this->downloadUrl()
        ];
    }
1074605
public function getCustomerInfo(): array
    {
        return [
            'email' => (string) $this->xml->CustomerInformation->Email,
            'phoneNumber' => (string) $this->xml->CustomerInformation->PhoneNumber,
            'customerNumber' => (string) $this->xml->CustomerInformation->CustomerNumber,
            'firstName' => (string) $this->xml->CustomerInformation->FirstName,
            'lastName' => (string) $this->xml->CustomerInformation->LastName,
            'address1' => (string) $this->xml->CustomerInformation->Address1,
            'address2' => (string) $this->xml->CustomerInformation->Address2,
            'postcode' => (string) $this->xml->CustomerInformation->Postcode,
            'town' => (string) $this->xml->CustomerInformation->Town,
            'country' => (string) $this->xml->CustomerInformation->Country,
            'socialSecurityNumber' => (string) $this->xml->CustomerInformation->SocialSecurityNumber,
            'companyName' => (string) $this->xml->CustomerInformation->CompanyName,
            'companyRegistrationNumber' => (string) $this->xml->CustomerInformation->CompanyRegistrationNumber,
        ];
    }
45258
public function toArray(): array
    {
        return [
            "clientFilename" => $this->getClientFilename(),
            "unverifiedContentType" => $this->error ? "" : $this->getContentType(true),
            "verifiedContentType" => $this->error ? "" : $this->getContentType(),
            "size" => $this->error ? 0 : $this->getSize(),
            "tempPath" => $this->error ? "" : $this->getTempPath(),
            "error" => $this->error ? $this->error->getMessage() : "",
        ];
    }
254945
public function actionIndex()
    {
        $this->requirePostRequest();
        $request = Craft::$app->getRequest();

        // Set params
        $params = [
          'name' => $request->post('name'),
          'contact' => $request->post('contact'),
          'permission_reminder' => $request->post('permission_reminder'),
          'campaign_defaults' => $request->post('campaign_defaults'),
          'email_type_option' => $request->post('email_type_option') ? true : false
        ];

        // Post request to create list
        $response = HttpService::request('POST', 'lists', $params);

        if ($response['success'] and $response['statusCode'] === 200) {
          Craft::$app->getSession()->setNotice('List created.');
          return $this->redirectToPostedUrl();
        } elseif ($response['success'] and $response['statusCode'] !== 200) {
          Craft::$app->session->setFlash('errorBody', $response['body']);
          Craft::$app->getSession()->setError($response['statusCode'].' '.$response['reason']);
        } else {
          Craft::$app->getSession()->setError($response['reason']);
        }

        return $this->redirect('mailchimp-lists/create');
    }
1008104
public function getFileInfo()
    {
        $result = array(
            "state" => $this->stateInfo,
            "url" => $this->fullName,
            "title" => $this->fileName,
            "original" => $this->oriName,
            "type" => $this->fileType,
            "size" => $this->fileSize
        );
        if( in_array($_GET['action'], ['uploadfile', 'uploadvideo', 'uploadscrawl']) ) $result['url'] = yii::$app->params['site']['url'].'/uploads/article/ueditor'.$result['url'];
        return $result;
    }
223095
public function rules()
    {
        return [
            'description' => 'required|max:100',

            '_pictures_file' => [
                'mimes:jpeg,png,jpg',
                Rule::dimensions()->maxWidth(1000)->maxHeight(500)
            ],

            'name' => [
                'required',
                Rule::unique('categories')->ignore($this->request->get('current_category')),
            ],
        ];
    }
1059753
public function getFileInfo()
    {
        $fullName = $this->getSetting('storeUrl') . '/' . str_replace('\\', '/', $this->fullName);
        return [
            "state" => $this->stateInfo,
            "url" => $fullName,
            "title" => $this->oriName,
            "original" => $this->oriName,
            "type" => $this->fileType,
            "size" => $this->fileSize
        ];
    }
982706
public function toData()
    {
        if ($this->type === self::TYPE_LOCATION) {
            return ['content_type' => 'location'];
        }

        return array_merge([
            'content_type' => 'text',
            'title' => $this->title,
            'payload' => $this->payload,
        ], $this->imageUrl ? ['image_url' => $this->imageUrl] : []);
    }