public function getCheckbox($name, array $options=[]) {
		$choices = $this->getChoices();
		$default = $this->value;

		$value = isset($options['value']) ? $options['value']:null;
		if($value===null) {
			foreach($choices as $k=>$v) {
				if($v == $name) {
					$value = $k;
					break;
				}
			}
		}
		if($value === null)
			throw new \Exception('No value for checkbox '.$name);

		if(in_array($value, $default))
			$options['attrs']['checked'] = 'checked';
		$options['label'] = $name;

		return $this->getTopForm()->getWidget('checkbox', $this->name.'[]', $value, $options);
	}
public function getCheckbox($name, array $options=[]) {
		$choices = $this->getChoices();
		$default = $this->value;

		$value = isset($options['value']) ? $options['value']:null;
		if($value===null) {
			foreach($choices as $k=>$v) {
				if($v == $name) {
					$value = $k;
					break;
				}
			}
		}
		if($value === null)
			throw new \Exception('No value for checkbox '.$name);

		if(in_array($value, $default))
			$options['attrs']['checked'] = 'checked';
		$options['label'] = $name;

		return $this->getTopForm()->getWidget('checkbox', $this->name.'[]', $value, $options);
	}
public function getCheckbox ( $ name , array $ options = [ ] ) { $ choices = $ this -> getChoices ( ) ; $ default = $ this -> value ; $ value = isset ( $ options [ 'value' ] ) ? $ options [ 'value' ] : null ; if ( $ value === null ) { foreach ( $ choices as $ k => $ v ) { if ( $ v == $ name ) { $ value = $ k ; break ; } } } if ( $ value === null ) throw new \ Exception ( 'No value for checkbox ' . $ name ) ; if ( in_array ( $ value , $ default ) ) $ options [ 'attrs' ] [ 'checked' ] = 'checked' ; $ options [ 'label' ] = $ name ; return $ this -> getTopForm ( ) -> getWidget ( 'checkbox' , $ this -> name . '[]' , $ value , $ options ) ; }
Return a checkbox widget.
@param  string $name
@param  array  $options
@return Widget
Return a checkbox widget .