@inheritdoc

@throws \yii\base\InvalidConfigException
556362
public function init()
	{
		//assert proper model is set
		if ($this->subject === null || !ComponentConfig::isActiveRecord($this->subject, false)) {
			$msg = Yii::t('app', 'Setting the model property of type ActiveRecord is mandatory');
			throw new InvalidConfigException($msg);
		}
		ComponentConfig::hasBehavior($this->subject, CommentsBehavior::className(), true);

		//load the comments
		$this->loadComments();

		//prepare options
		Html::addCssClass($this->options, 'widget-comments');
		Html::addCssClass($this->commentOptions, 'comment');
	}
354018
public function init()
    {
        // if set use CKEditor configurations from settings module else use default configuration.
        $json = \Yii::$app->settings->get('ckeditor.config', 'widgets');
        $ckeditorConfiguration = isset($json->scalar) ? $json->scalar : "{}";
        $script = "window.CKCONFIG = {$ckeditorConfiguration};";
        \Yii::$app->view->registerJs($script, \yii\web\View::POS_HEAD);


        if ($this->name === null && !$this->hasModel() && $this->selector === null) {
            throw new InvalidConfigException("Either 'name', or 'model' and 'attribute' properties must be specified.");
        }

        if (null === $this->schema) {
            throw new InvalidConfigException("You must specify 'schema' property.");
        }

        if ($this->hasModel() && !isset($this->options['id'])) {
            $this->options['id'] = Html::getInputId($this->model, $this->attribute);
        }

        if ($this->hasModel()) {
            $this->name  = empty($this->options['name']) ? Html::getInputName($this->model, $this->attribute) : $this->options['name'];
            $this->value = Html::getAttributeValue($this->model, $this->attribute);
        }

        if (!isset($this->containerOptions['id'])) {
            $this->containerOptions['id'] = ($this->hasModel() ? Html::getInputId($this->model, $this->attribute) : $this->getId()) . '-container';
        }

        if ($this->inputId === null) {
            $this->inputId = $this->options['id'];
        } else {
            $this->_renderInput = false;
        }

        parent::init();
        JsonEditorAsset::register($this->getView());
        JsonEditorPluginsAsset::register($this->getView());
    }
1272191
public function init()
    {
        if ($this->attribute === null) {
            throw new InvalidConfigException('Please specify the "attribute" property.');
        }

        if (!isset($this->options['id'])) {
            $this->options['id'] = $this->getMdeditorId();
        }
    }
822831
public function init()
    {
        foreach (static::defaultConfig() as $key => $value) {
            if (!isset($this->{$key})) {
                $this->{$key} = $value;
            }
        }
        foreach (static::requiredConfig() as $key) {
            if (!isset($this->{$key})) {
                throw new InvalidConfigException(get_class($this) . " key provider requires '{$key}' config key");
            }
        }
        KeyProviderCollector::internalRegisterProvider($this);
    }
937624
public function init()
	{
		if ($this->model === null) {
            throw new InvalidConfigException('Please specify the "model" property.');
        }
        if ($this->formatter == null) {
            $this->formatter = Yii::$app->getFormatter();
        } elseif (is_array($this->formatter)) {
            $this->formatter = Yii::createObject($this->formatter);
        }
        if (!$this->formatter instanceof Formatter) {
            throw new InvalidConfigException('The "formatter" property must be either a Format object or a configuration array.');
        }
		
		if($this->nullDisplay === null)
			$this->nullDisplay='<span class="null">'.Yii::t('app','Not set').'</span>';
			$this->options['id'] = $this->getId();

		//$this->normalizeAttributes();
	}
716502
public function run($id, $attribute)
    {
        $model = $this->findModel($this->modelClass, $id);

        if (!$model->hasAttribute($attribute)) {
            throw new InvalidConfigException("Attribute doesn't exist.");
        }

        if ($model->$attribute == $this->onValue) {
            $model->$attribute = $this->offValue;
        } else {
            $model->$attribute = $this->onValue;
        }

        if ($this->preProcess && is_callable($this->preProcess, true)) {
            call_user_func($this->preProcess, $model);
        }

        if ($model->save(true, [$attribute])) {
            if ($this->setFlash) {
                Yii::$app->session->setFlash('success', $this->flashSuccess);
            }
        } else {
            if ($this->setFlash) {
                Yii::$app->session->setFlash('error', $this->flashError);
            }
        }

        if (Yii::$app->request->getIsAjax()) {
            Yii::$app->end();
        }

        if (!empty($this->redirect)) {
            return $this->controller->redirect($this->redirect);
        }

        return $this->controller->redirect(Yii::$app->request->getReferrer());
    }
910848
protected function checkConditionConfiguration()
    {
        $configuration = $this->formObject->getConfiguration();

        if (false === $configuration->hasField($this->fieldName)) {
            throw InvalidConditionException::conditionFieldCountValuesFieldNotFound($this->fieldName);
        }
    }
939674
public function init() {
		parent::init();
		if( $this->parser === null ) {
			$this->_p = Yii::createObject([
				'class' => DefaultArrayParser::className()
			]);
		} elseif( $this->parser === false) {
			$this->_p = null;
		} elseif( is_array($this->parser)) {
			$this->_p = Yii::createObject($this->parser);
		} elseif( is_string($this->parser)) {
			$this->_p = Yii::$app->get($this->parser);
		} elseif( is_object($this->parser)) {
			$this->_p = $this->parser;
		} else {
			throw new InvalidConfigException('invalid "parser" attribute : string or array expected');
		}

		if( $this->_p !== null && ! $this->_p instanceof WorkflowArrayParser ) {
			throw new InvalidConfigException('the parser component must implement the WorkflowArrayParser interface');
		}
	}
855541
protected function initOptions()
    {
        if (!($this->model instanceof Model)) {
            throw new InvalidConfigException('Model is required');
        }

        if (!($this->model->getPrimaryKey())) {
            throw new InvalidConfigException('Model has empty primary key');
        }

        if ($this->button !== false) {
            $this->button['position'] = isset($this->button['position']) ? $this->button['position'] : static::BUTTON_OUTSIDE;
        }

        if (empty($this->scenario)) {
            $this->scenario = $this->model->scenario;
        } else {
            $this->_oldScenario = $this->model->scenario;
            $this->model->scenario = $this->scenario;
        }

        if ($this->form !== false) {
            $formConfig = [
                'method' => 'POST',
                'action' => $this->scenario,
                'options' => [
                    'class' => 'inline',
                    'data' => [
                        'modal-form' => true,
                    ],
                ],
            ];
            if ($this->submit === static::SUBMIT_PJAX) {
                $formConfig['options'] = ArrayHelper::merge($formConfig['options'], [
                    'data' => ['pjax' => 1, 'pjax-push' => 0],
                ]);
            } elseif ($this->submit === static::SUBMIT_AJAX) {
                $formConfig['options'] = ArrayHelper::merge($formConfig['options'], [
                    'data' => ['ajax-submit' => 1],
                ]);

                $this->registerAjaxSubmit();
            }

            $this->form = ArrayHelper::merge($formConfig, $this->form);
        }

        if (is_array($footer = $this->modal['footer'])) {
            $tag = ArrayHelper::remove($footer, 'tag', 'input');
            $label = ArrayHelper::remove($footer, 'label', 'OK');
            $footer = ArrayHelper::merge([
                'data-modal-submit' => true,
                'data-loading-text' => '<i class="fa fa-circle-o-notch fa-spin"></i> ' . Yii::t('hipanel', 'loading'),
            ], $footer);

            if ($tag === 'input') {
                $footer['type']  = 'submit';
                $footer['value'] = $label;
            }

            $this->modal['footer'] = Html::tag($tag, $label, $footer);
            $this->registerFooterButtonScript();
        }

        $this->modal = ArrayHelper::merge([
            'id' => $this->getModalId(),
            'toggleButton' => ($this->button['position'] === static::BUTTON_IN_MODAL) ? $this->button : false,
        ], $this->modal);
    }
1253862
public function registerCache()
    {
        if ($this->module->cacheComponent !== false && !is_string($this->module->cacheComponent) && !is_array($this->module->cacheComponent)) {
            throw new InvalidConfigException('Invalid value for the cacheComponent parameter.');
        }
        if (is_string($this->module->cacheComponent)) {
            return;
        }
        $this->module->set('podium_cache', is_array($this->module->cacheComponent)
            ? $this->module->cacheComponent
            : ['class' => 'yii\caching\DummyCache']);
    }
286196
public function init( $configType ) {

		$siteService = Yii::$app->factory->get( 'siteService' );

		$site		= Yii::$app->core->site;
		$siteSlug	= Yii::$app->core->siteSlug;

		if( Yii::$app->core->siteConfigAll ) {

			if( empty( self::$typePropertyMap ) ) {

				self::$typePropertyMap = [];

				$properties	= [];

				// Load main site properties and override with child site properties
				if( Yii::$app->core->multiSite && !( $siteSlug == CoreGlobal::SITE_MAIN ) ) {

					$mainSite = $siteService->getBySlug( CoreGlobal::SITE_MAIN );

					$mainProperties = $siteService->getIdMetaMap( $mainSite );
					$siteProperties = $siteService->getIdMetaMap( $site );

					$properties = ArrayHelper::merge( $mainProperties, $siteProperties );
				}
				// Load main site properties
				else {

					$properties	= $siteService->getIdMetaMap( $site );
				}

				foreach( $properties as $property ) {

					$type = $property->type;

					if( !isset( self::$typePropertyMap[ $type ] ) ) {

						self::$typePropertyMap[ $type ] = [];
					}

					self::$typePropertyMap[ $type ][ $property->name ] = $property->value;
				}
			}

			$this->properties = self::$typePropertyMap[ $configType ];
		}
		else {

			// Load main site properties and override with child site properties
			if( Yii::$app->core->multiSite && !( $siteSlug == CoreGlobal::SITE_MAIN ) ) {

				$mainSite = $siteService->getBySlug( CoreGlobal::SITE_MAIN );

				$mainProperties = $siteService->getMetaNameValueMapByMetaType( $mainSite, $configType );
				$siteProperties = $siteService->getMetaNameValueMapByMetaType( $site, $configType );

				$this->properties = ArrayHelper::merge( $mainProperties, $siteProperties );
			}
			// Load main site properties
			else {

				$this->properties = $siteService->getMetaNameValueMapByMetaType( $site, $configType );
			}
		}
	}
1058701
public function init(): void
    {
        if (!in_array($this->layout, [self::LAYOUT_DEFAULT, self::LAYOUT_HORIZONTAL, self::LAYOUT_INLINE])) {
            throw new InvalidConfigException('Invalid layout type: ' . $this->layout);
        }

        if ($this->layout === 'inline') {
            Html::addCssClass($this->options, 'form-inline');
        }
        parent::init();
    }
77504
private function _checkVariables() {
	    // Check to make sure that the $databaseComponent is a string
        if (! is_string($this->databaseComponent)) {
            throw new InvalidConfigException("Image Manager Component - Init: Database component '$this->databaseComponent' is not a string");
        }

        // Check to make sure that the $databaseComponent object exists
        if (Yii::$app->get($this->databaseComponent, false) === null) {
            throw new InvalidConfigException("Image Manager Component - Init: Database component '$this->databaseComponent' does not exists in application configuration");
        }

        // Check to make sure that the $databaseComponent is a yii\db\Connection object
        if (($databaseComponentClassName = get_class(Yii::$app->get($this->databaseComponent))) !== ($connectionClassName = Connection::className())) {
            throw new InvalidConfigException("Image Manager Component - Init: Database component '$this->databaseComponent' is not of type '$connectionClassName' instead it is '$databaseComponentClassName'");
        }
    }
356912
public function init()
    {
        if ($this->dataProvider === null) {
            throw new InvalidConfigException('The "dataProvider" property must be set');
        }
        $this->channelAttributes = $this->getAttributes($this->channel);
        foreach ($this->requiredChannelElements as $channelElement) {
            if (!in_array($channelElement, $this->channelAttributes)) {
                throw new InvalidConfigException('Required channel attribute "' . $channelElement . '" must be set');
            }
        }
        $this->itemAttributes = $this->getAttributes($this->items);
        foreach ($this->requiredItemElements as $itemElement) {
            if (!in_array($itemElement, $this->itemAttributes)) {
                throw new InvalidConfigException('Required item attribute "' . $itemElement . '" must be set');
            }
        }
        $this->feed = new Feed;
    }
30943
public function init()
    {
        if ($this->model === null) {
            throw new InvalidConfigException('Please specify the "model" property.');
        }

        $this->dataProvider = new ArrayDataProvider(['allModels' => [$this->model]]);
        parent::init();
    }
1005463
public function run()
    {
        Yii::$app->response->format = Response::FORMAT_JSON;
        $param = Yii::$app->request->get($this->clientIdGetParamName);
        if (mb_strlen($param) < 2) {
            if (YII_DEBUG) {
                throw new InvalidConfigException ("Operator '{$this->clientIdGetParamName}' requires two operands.");
            } else {
                return [];
            }
        } else {
            $query = Tag::find();
            $rows = $query->select(['id', 'name', 'name as text', 'frequency'])
                ->where(['like', 'name', $param])
                ->orderBy(['frequency' => SORT_DESC])
                ->limit(Yii::$app->request->get($this->clientLimitGetParamName, 20))
                ->asArray()
                ->all();
            return $rows;
        }
    }
1356385
protected function createModel()
    {
        if ($this->model instanceof \yii\base\Model) {
            Yii::info('Model already configured as instanceof ' . $this->model->className(), __METHOD__);

            return false;
        }

        if (is_array($this->model)) {
            if (!ArrayHelper::isIndexed($this->model) || !$this->model[0] instanceof \yii\base\Model) {
                throw new InvalidConfigException("Property 'model'"
                    . ' must be configured as indexed array of \\yii\\base\\Model');
            }
            Yii::info('Model property configured as array of ' . $this->model[0]->className(), __METHOD__);

            return false;
        }

        if (is_string($this->model)) {
            $this->model = Yii::createObject($configuration = ['class' => $this->model]);
            Yii::info('Model initialized with configuration: ' . VarDumper::dumpAsString($configuration), __METHOD__);
        }

        return true;
    }