/content/code/trunk/administrator/components/com_artofcontent/libraries/jxtended/form/fields/checkbox.php
PHP | 43 lines | 14 code | 4 blank | 25 comment | 2 complexity | c32817e736a5ec0f6c659169db353ad8 MD5 | raw file
- <?php
- /**
- * @version $Id: checkbox.php 484 2010-12-20 23:40:27Z eddieajau $
- * @package JXtended.Libraries
- * @subpackage Form
- * @copyright Copyright 2005 - 2010 New Life in IT Pty Ltd. All rights reserved.
- * @license GNU General Public License
- * @link http://www.theartofjoomla.com
- */
- defined('JPATH_BASE') or die('Restricted Access');
- jimport('joomla.html.html');
- juimport('jxtended.form.formfield');
- /**
- * Form Field class for JXtended Libraries.
- *
- * @package JXtended.Libraries
- * @subpackage Form
- * @since 1.1
- */
- class JFormFieldCheckbox extends JFormField
- {
- /**
- * The field type.
- *
- * @var string
- */
- public $type = 'Checkbox';
- /**
- * Method to get the field input.
- *
- * @return string The field input.
- */
- protected function _getInput()
- {
- $value = $this->_element->attributes('value') !== null ? $this->_element->attributes('value') : '';
- $checked = (!empty($value) && $value == $this->value) ? 'checked="checked"' : '';
- return '<input type="checkbox" name="'.$this->inputName.'" id="'.$this->inputId.'" value="'.$value.'" '.$checked.' />';
- }
- }