public function validate(ValidationResult $result) {

		// Determine the field to use, based on the configuration defined tag types.

		$validate = 'Title';
		$class = $this->owner->ClassName;
		foreach(Config::inst()->get('FusionService', 'custom_tag_types') as $type => $field) {
			if($type === $class) {
				$validate = $field;
			}
		}

		// Confirm that the tag has been given a title and doesn't already exist.

		if($result->valid() && !$this->owner->$validate) {
			$result->error("\"{$validate}\" required!");
		}

		// Allow extension.

		$this->owner->extend('validateFusionExtension', $result);
		return $result;
	}
public function validate(ValidationResult $result) {

		// Determine the field to use, based on the configuration defined tag types.

		$validate = 'Title';
		$class = $this->owner->ClassName;
		foreach(Config::inst()->get('FusionService', 'custom_tag_types') as $type => $field) {
			if($type === $class) {
				$validate = $field;
			}
		}

		// Confirm that the tag has been given a title and doesn't already exist.

		if($result->valid() && !$this->owner->$validate) {
			$result->error("\"{$validate}\" required!");
		}

		// Allow extension.

		$this->owner->extend('validateFusionExtension', $result);
		return $result;
	}
public function validate ( ValidationResult $ result ) { // Determine the field to use, based on the configuration defined tag types. $ validate = 'Title' ; $ class = $ this -> owner -> ClassName ; foreach ( Config :: inst ( ) -> get ( 'FusionService' , 'custom_tag_types' ) as $ type => $ field ) { if ( $ type === $ class ) { $ validate = $ field ; } } // Confirm that the tag has been given a title and doesn't already exist. if ( $ result -> valid ( ) && ! $ this -> owner -> $ validate ) { $ result -> error ( "\"{$validate}\" required!" ) ; } // Allow extension. $ this -> owner -> extend ( 'validateFusionExtension' , $ result ) ; return $ result ; }
Confirm that the tag has been given a title and doesn't already exist.
Confirm that the tag has been given a title and doesn t already exist .