src/ItePHP/Component/Form/SelectField.php
public function componentRender(){
		$template='<select ';
		foreach($this->getTags() as $kTag=>$tag){
			if($tag!=''){
				if($kTag=='name' && $this->isMultiple()){
					$tag.='[]';
				}

				$template.=$kTag.'="'.htmlspecialchars($tag).'" ';

			}
		}

		$template.='>';
		$values=(is_array($this->getData())?$this->getData():[$this->getData()]);
		foreach($this->collection as $option){
			$template.='<option value="'.htmlspecialchars($option['value']).'" '.(in_array($option['value'], $values)?'selected':'').'>'.htmlspecialchars($option['label']).'</option>';
		}

		$template.='</select>';
		return $template;
	}
public function componentRender(){
		$template='<select ';
		foreach($this->getTags() as $kTag=>$tag){
			if($tag!=''){
				if($kTag=='name' && $this->isMultiple()){
					$tag.='[]';
				}

				$template.=$kTag.'="'.htmlspecialchars($tag).'" ';

			}
		}

		$template.='>';
		$values=(is_array($this->getData())?$this->getData():[$this->getData()]);
		foreach($this->collection as $option){
			$template.='<option value="'.htmlspecialchars($option['value']).'" '.(in_array($option['value'], $values)?'selected':'').'>'.htmlspecialchars($option['label']).'</option>';
		}

		$template.='</select>';
		return $template;
	}
public function componentRender ( ) { $ template = '<select ' ; foreach ( $ this -> getTags ( ) as $ kTag => $ tag ) { if ( $ tag != '' ) { if ( $ kTag == 'name' && $ this -> isMultiple ( ) ) { $ tag .= '[]' ; } $ template .= $ kTag . '="' . htmlspecialchars ( $ tag ) . '" ' ; } } $ template .= '>' ; $ values = ( is_array ( $ this -> getData ( ) ) ? $ this -> getData ( ) : [ $ this -> getData ( ) ] ) ; foreach ( $ this -> collection as $ option ) { $ template .= '<option value="' . htmlspecialchars ( $ option [ 'value' ] ) . '" ' . ( in_array ( $ option [ 'value' ] , $ values ) ? 'selected' : '' ) . '>' . htmlspecialchars ( $ option [ 'label' ] ) . '</option>' ; } $ template .= '</select>' ; return $ template ; }
{@inheritdoc}
{