ACC SHELL
<?php
/**
* This file is part of the Nette Framework (http://nette.org)
* Copyright (c) 2004 David Grudl (http://davidgrudl.com)
* @package Nette\Forms\Controls
*/
/**
* Check box control. Allows the user to select a true or false condition.
*
* @author David Grudl
* @package Nette\Forms\Controls
*/
class NCheckbox extends NFormControl
{
/**
* @param string label
*/
public function __construct($label = NULL)
{
parent::__construct($label);
$this->control->type = 'checkbox';
$this->value = FALSE;
}
/**
* Sets control's value.
* @param bool
* @return self
*/
public function setValue($value)
{
$this->value = is_scalar($value) ? (bool) $value : FALSE;
return $this;
}
/**
* Generates control's HTML element.
* @return NHtml
*/
public function getControl()
{
return parent::getControl()->checked($this->value);
}
}
ACC SHELL 2018