pfsense/usr/local/www/classes/Form/Checkbox.class.php
Sjon Hortensius 69f9ff4034 final touches on Forms
system - removed trailing unused form-html
Form - set proper width for submit-button column
Element - support returning raw-list for Inputs
Group,Input - renamed getColumnWidth to getWidth
Input - make setWidth consistent with Form->setWidth, directly add
  proper class to column
2015-01-27 21:33:41 +01:00

28 lines
580 B
PHP

<?php
class Form_Checkbox extends Form_Input
{
protected $_description;
public function __construct($title, $description, $checked, $value = 'yes')
{
parent::__construct($title, 'checkbox');
$this->_description = $description;
$this->removeClass('form-control');
if ($checked)
$this->_attributes['checked'] = 'checked';
}
protected function _getInput()
{
$this->addColumnClass('checkbox');
$input = parent::_getInput();
if (!isset($this->_description))
return $input;
return '<label>'. $input .' '. gettext($this->_description) .'</label>';
}
}