MultiCheckbox.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <?php
  2. /**
  3. * Zend Framework
  4. *
  5. * LICENSE
  6. *
  7. * This source file is subject to the new BSD license that is bundled
  8. * with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://framework.zend.com/license/new-bsd
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to license@zend.com so we can send you a copy immediately.
  14. *
  15. * @category Zend
  16. * @package Zend_Form
  17. * @subpackage Element
  18. * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. */
  21. /** Zend_Form_Element_Multi */
  22. require_once 'Zend/Form/Element/Multi.php';
  23. /**
  24. * MultiCheckbox form element
  25. *
  26. * Allows specifyinc a (multi-)dimensional associative array of values to use
  27. * as labelled checkboxes; these will return an array of values for those
  28. * checkboxes selected.
  29. *
  30. * @category Zend
  31. * @package Zend_Form
  32. * @subpackage Element
  33. * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
  34. * @license http://framework.zend.com/license/new-bsd New BSD License
  35. * @version $Id$
  36. */
  37. class Zend_Form_Element_MultiCheckbox extends Zend_Form_Element_Multi
  38. {
  39. /**
  40. * Use formMultiCheckbox view helper by default
  41. * @var string
  42. */
  43. public $helper = 'formMultiCheckbox';
  44. /**
  45. * MultiCheckbox is an array of values by default
  46. * @var bool
  47. */
  48. protected $_isArray = true;
  49. /**
  50. * Load default decorators
  51. *
  52. * @return Zend_Form_Element_MultiCheckbox
  53. */
  54. public function loadDefaultDecorators()
  55. {
  56. if ($this->loadDefaultDecoratorsIsDisabled()) {
  57. return $this;
  58. }
  59. parent::loadDefaultDecorators();
  60. // Disable 'for' attribute
  61. if (false !== $decorator = $this->getDecorator('label')) {
  62. $decorator->setOption('disableFor', true);
  63. }
  64. return $this;
  65. }
  66. }