PageRenderTime 45ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/content/code/trunk/administrator/components/com_artofcontent/libraries/jxtended/form/fields/checkbox.php

https://bitbucket.org/eddieajau/the-art-of-joomla-archive
PHP | 43 lines | 14 code | 4 blank | 25 comment | 2 complexity | c32817e736a5ec0f6c659169db353ad8 MD5 | raw file
  1. <?php
  2. /**
  3. * @version $Id: checkbox.php 484 2010-12-20 23:40:27Z eddieajau $
  4. * @package JXtended.Libraries
  5. * @subpackage Form
  6. * @copyright Copyright 2005 - 2010 New Life in IT Pty Ltd. All rights reserved.
  7. * @license GNU General Public License
  8. * @link http://www.theartofjoomla.com
  9. */
  10. defined('JPATH_BASE') or die('Restricted Access');
  11. jimport('joomla.html.html');
  12. juimport('jxtended.form.formfield');
  13. /**
  14. * Form Field class for JXtended Libraries.
  15. *
  16. * @package JXtended.Libraries
  17. * @subpackage Form
  18. * @since 1.1
  19. */
  20. class JFormFieldCheckbox extends JFormField
  21. {
  22. /**
  23. * The field type.
  24. *
  25. * @var string
  26. */
  27. public $type = 'Checkbox';
  28. /**
  29. * Method to get the field input.
  30. *
  31. * @return string The field input.
  32. */
  33. protected function _getInput()
  34. {
  35. $value = $this->_element->attributes('value') !== null ? $this->_element->attributes('value') : '';
  36. $checked = (!empty($value) && $value == $this->value) ? 'checked="checked"' : '';
  37. return '<input type="checkbox" name="'.$this->inputName.'" id="'.$this->inputId.'" value="'.$value.'" '.$checked.' />';
  38. }
  39. }