public addCheckbox ( string $name, boolean $checked = false, string $class = null, string $classError = null ) : |
||
$name | string | The name of the element. |
$checked | boolean | Should the checkbox be checked? |
$class | string | Class(es) that will be applied on the element. |
$classError | string | Class(es) that will be applied on the element when an error occurs. |
return |
public function addCheckbox($name, $checked = false, $class = null, $classError = null)
{
$name = (string) $name;
$checked = (bool) $checked;
$class = $class !== null ? (string) $class : 'fork-form-checkbox';
$classError = $classError !== null ? (string) $classError : 'error';
// create and return a checkbox
$this->add(new CommonFormCheckbox($name, $checked, $class, $classError));
// return element
return $this->getField($name);
}