common/actions/meta/Update.php
public function run( $cid ) {

		$parent	= $this->model;

		if( isset( $parent ) ) {

			$meta		= $this->metaService->getById( $cid );
			$belongsTo	= $meta->hasAttribute( 'modelId' ) ? $meta->belongsTo( $parent ) : $meta->belongsTo( $parent, $this->modelService->getParentType() );

			if( isset( $meta ) && $belongsTo ) {

				if( $meta->load( Yii::$app->request->post(), $meta->getClassName() ) && $meta->validate() ) {

					$this->metaService->update( $meta );

					$meta->refresh();

					$data = [ 'id' => $meta->id, 'name' => $meta->name, 'value' => HtmlPurifier::process( $meta->value ) ];

					// Trigger Ajax Success
					return AjaxUtil::generateSuccess( Yii::$app->coreMessage->getMessage( CoreGlobal::MESSAGE_REQUEST ), $data );
				}

				// Generate Errors
				$errors = AjaxUtil::generateErrorMessage( $model );

				// Trigger Ajax Failure
				return AjaxUtil::generateFailure( Yii::$app->coreMessage->getMessage( CoreGlobal::ERROR_REQUEST ), $errors );
			}
		}

		// Trigger Ajax Failure
		return AjaxUtil::generateFailure( Yii::$app->cmgCoreMessage->getMessage( CoreGlobal::ERROR_NOT_FOUND ) );
	}
public function run( $cid ) {

		$parent	= $this->model;

		if( isset( $parent ) ) {

			$meta		= $this->metaService->getById( $cid );
			$belongsTo	= $meta->hasAttribute( 'modelId' ) ? $meta->belongsTo( $parent ) : $meta->belongsTo( $parent, $this->modelService->getParentType() );

			if( isset( $meta ) && $belongsTo ) {

				if( $meta->load( Yii::$app->request->post(), $meta->getClassName() ) && $meta->validate() ) {

					$this->metaService->update( $meta );

					$meta->refresh();

					$data = [ 'id' => $meta->id, 'name' => $meta->name, 'value' => HtmlPurifier::process( $meta->value ) ];

					// Trigger Ajax Success
					return AjaxUtil::generateSuccess( Yii::$app->coreMessage->getMessage( CoreGlobal::MESSAGE_REQUEST ), $data );
				}

				// Generate Errors
				$errors = AjaxUtil::generateErrorMessage( $model );

				// Trigger Ajax Failure
				return AjaxUtil::generateFailure( Yii::$app->coreMessage->getMessage( CoreGlobal::ERROR_REQUEST ), $errors );
			}
		}

		// Trigger Ajax Failure
		return AjaxUtil::generateFailure( Yii::$app->cmgCoreMessage->getMessage( CoreGlobal::ERROR_NOT_FOUND ) );
	}
public function run ( $ cid ) { $ parent = $ this -> model ; if ( isset ( $ parent ) ) { $ meta = $ this -> metaService -> getById ( $ cid ) ; $ belongsTo = $ meta -> hasAttribute ( 'modelId' ) ? $ meta -> belongsTo ( $ parent ) : $ meta -> belongsTo ( $ parent , $ this -> modelService -> getParentType ( ) ) ; if ( isset ( $ meta ) && $ belongsTo ) { if ( $ meta -> load ( Yii :: $ app -> request -> post ( ) , $ meta -> getClassName ( ) ) && $ meta -> validate ( ) ) { $ this -> metaService -> update ( $ meta ) ; $ meta -> refresh ( ) ; $ data = [ 'id' => $ meta -> id , 'name' => $ meta -> name , 'value' => HtmlPurifier :: process ( $ meta -> value ) ] ; // Trigger Ajax Success return AjaxUtil :: generateSuccess ( Yii :: $ app -> coreMessage -> getMessage ( CoreGlobal :: MESSAGE_REQUEST ) , $ data ) ; } // Generate Errors $ errors = AjaxUtil :: generateErrorMessage ( $ model ) ; // Trigger Ajax Failure return AjaxUtil :: generateFailure ( Yii :: $ app -> coreMessage -> getMessage ( CoreGlobal :: ERROR_REQUEST ) , $ errors ) ; } } // Trigger Ajax Failure return AjaxUtil :: generateFailure ( Yii :: $ app -> cmgCoreMessage -> getMessage ( CoreGlobal :: ERROR_NOT_FOUND ) ) ; }
Update Meta for given Meta id, parent slug and parent type.
Update Meta for given Meta id parent slug and parent type .