private static function dumpCb(CheckboxFormControl $control) { return <<<EOT <dt>{$control->toHtml($control->hasError() ? array('style' => 'border:1px solid red;') : array())}</dt> <dd>{$control->getLabel()}</dd> EOT; }
function getControls() { $yield = array(); $values = $this->getSelectedValues(); $isImported = $this->isImported(); foreach ($this->getOptions() as $value => $label) { $control = new CheckboxFormControl($this->getInnerName(), $label, $value); if (in_array($value, $values)) { if ($isImported) { $control->importValue($value); } else { $control->setDefaultValue($value); } } } return $yield; }
/** * @return CheckboxFormControl */ static function checkbox($name, $label, $checked = false, $value = '1') { return CheckboxFormControl::create($name, $label, $value)->setDefaultValue($checked ? $value : null); }