Return to Snippet

Revision: 34273
at October 20, 2010 06:13 by sorinspanu


Initial Code
<?php 
class GenreForm extends BaseGenreForm {
	
	static public $decision = array(1 => 'Enable', 0 => 'Disable');
	public function getDecision() { return self::$decision; }
	
	public function configure() {
		$this->widgetSchema['is_published'] = new sfWidgetFormSelectRadio(array(
			'choices' => $this->getDecision(),
			'formatter' => array($this, "formatRadioList")
		));
	}
	
	public function formatRadioList($widget, $inputs) {
		$rows = array();
		foreach ($inputs as $input) {
			$rows[] = $input['input'];
		}
		
		$string = implode($this->getOption('separator'), $rows);
		
		return $string;
	}
}
?>

Initial URL

                                

Initial Description

                                

Initial Title
Format Radio List in a Form Class

Initial Tags
form, class, list, format

Initial Language
PHP