private static function createSingleElement($type, $name, $value, $attributes, $options, $required, $modifiers, $validators, $validationErrorMessage) {

		switch($type) {
			case 'input':
				$elem = new InputElement($name);
				break;

            case 'file':
                $elem = new FileInputElement($name);
                break;

			case 'password':
				$elem = new PasswordInputElement($name);
				break;

			case 'submit':
				$elem = new SubmitInputElement($name);
				break;

			case 'checkbox':
				$elem = new CheckboxElement($name);
				break;

			case 'textarea':
				$elem = new TextareaElement($name);
				break;

			case 'image':
				$elem = new ImageElement($name);
				break;

			case 'button':
				$elem = new ButtonElement($name);
				if(isset($attributes['type'])) {
					$elem->setType($attributes['type']);
				}
				break;

			case 'select':
				$elem = new SelectElement($name);
				$elem->createOptions($options);
				break;

			case 'radio':
				$elem = new RadioElement($name);
				$elem->createOptions($options);
				break;

			case 'multipleselect':
				$elem = new MultipleSelectElement($name);
				$elem->createOptions($options);
				break;

			default:
				throw new FormElementFactoryException(sprintf("Unknown form element '%s''", $type));
		}

		$elem
			->setAttributes($attributes)
			->setRequired($required)
            ->setValidationErrorMessage($validationErrorMessage)
        ;

		foreach($modifiers as $modifier) {
			$elem->addModifier($modifier);
		}

		foreach($validators as $validator) {
			$elem->addValidator($validator);
		}

		$elem->setValue($value);

		return $elem;
	}
private static function createSingleElement($type, $name, $value, $attributes, $options, $required, $modifiers, $validators, $validationErrorMessage) {

		switch($type) {
			case 'input':
				$elem = new InputElement($name);
				break;

            case 'file':
                $elem = new FileInputElement($name);
                break;

			case 'password':
				$elem = new PasswordInputElement($name);
				break;

			case 'submit':
				$elem = new SubmitInputElement($name);
				break;

			case 'checkbox':
				$elem = new CheckboxElement($name);
				break;

			case 'textarea':
				$elem = new TextareaElement($name);
				break;

			case 'image':
				$elem = new ImageElement($name);
				break;

			case 'button':
				$elem = new ButtonElement($name);
				if(isset($attributes['type'])) {
					$elem->setType($attributes['type']);
				}
				break;

			case 'select':
				$elem = new SelectElement($name);
				$elem->createOptions($options);
				break;

			case 'radio':
				$elem = new RadioElement($name);
				$elem->createOptions($options);
				break;

			case 'multipleselect':
				$elem = new MultipleSelectElement($name);
				$elem->createOptions($options);
				break;

			default:
				throw new FormElementFactoryException(sprintf("Unknown form element '%s''", $type));
		}

		$elem
			->setAttributes($attributes)
			->setRequired($required)
            ->setValidationErrorMessage($validationErrorMessage)
        ;

		foreach($modifiers as $modifier) {
			$elem->addModifier($modifier);
		}

		foreach($validators as $validator) {
			$elem->addValidator($validator);
		}

		$elem->setValue($value);

		return $elem;
	}
private static function createSingleElement ( $ type , $ name , $ value , $ attributes , $ options , $ required , $ modifiers , $ validators , $ validationErrorMessage ) { switch ( $ type ) { case 'input' : $ elem = new InputElement ( $ name ) ; break ; case 'file' : $ elem = new FileInputElement ( $ name ) ; break ; case 'password' : $ elem = new PasswordInputElement ( $ name ) ; break ; case 'submit' : $ elem = new SubmitInputElement ( $ name ) ; break ; case 'checkbox' : $ elem = new CheckboxElement ( $ name ) ; break ; case 'textarea' : $ elem = new TextareaElement ( $ name ) ; break ; case 'image' : $ elem = new ImageElement ( $ name ) ; break ; case 'button' : $ elem = new ButtonElement ( $ name ) ; if ( isset ( $ attributes [ 'type' ] ) ) { $ elem -> setType ( $ attributes [ 'type' ] ) ; } break ; case 'select' : $ elem = new SelectElement ( $ name ) ; $ elem -> createOptions ( $ options ) ; break ; case 'radio' : $ elem = new RadioElement ( $ name ) ; $ elem -> createOptions ( $ options ) ; break ; case 'multipleselect' : $ elem = new MultipleSelectElement ( $ name ) ; $ elem -> createOptions ( $ options ) ; break ; default : throw new FormElementFactoryException ( sprintf ( "Unknown form element '%s''" , $ type ) ) ; } $ elem -> setAttributes ( $ attributes ) -> setRequired ( $ required ) -> setValidationErrorMessage ( $ validationErrorMessage ) ; foreach ( $ modifiers as $ modifier ) { $ elem -> addModifier ( $ modifier ) ; } foreach ( $ validators as $ validator ) { $ elem -> addValidator ( $ validator ) ; } $ elem -> setValue ( $ value ) ; return $ elem ; }
generate a single form element

@param $type
@param $name
@param $value
@param $attributes
@param $options
@param $required
@param $modifiers
@param $validators
@param $validationErrorMessage
@return ButtonElement|CheckboxElement|ImageElement|InputElement|PasswordInputElement|SubmitInputElement|TextareaElement

@throws FormElementFactoryException
generate a single form element