From 43c137ac23e52fe484703397f4e2def24416e385 Mon Sep 17 00:00:00 2001 From: skodak Date: Sat, 15 Sep 2007 19:43:01 +0000 Subject: [PATCH] applying the same patch to advcheckbox - Fixes MDL-8627, "HTML QuickForm displays (some?) disabled elements in a non-accessible way", overrides parent::getFrozenHtml. --- lib/form/advcheckbox.php | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/lib/form/advcheckbox.php b/lib/form/advcheckbox.php index 63f46357fd491..2c048c0d3d6ca 100644 --- a/lib/form/advcheckbox.php +++ b/lib/form/advcheckbox.php @@ -88,23 +88,28 @@ function _generateId() $this->updateAttributes(array('id' => 'id_'.substr(md5(microtime() . $idx++), 0, 6))); } } // end func _generateId - /** - * Slightly different container template when frozen. Don't want to use a label tag - * with a for attribute in that case for the element label but instead use a div. - * Templates are defined in renderer constructor. - * - * @return string - */ - function getElementTemplateType(){ - if ($this->_flagFrozen){ - return 'static'; - } else { - return 'default'; - } - } + function toHtml() { return '' . parent::toHtml() . ''; } + + /** + * Returns the disabled field. Accessibility: the return "[ ]" from parent + * class is not acceptable for screenreader users, and we DO want a label. + * @return string + */ + function getFrozenHtml() + { + //$this->_generateId(); + $output = 'getChecked()) { + $output .= 'checked="checked" />'.$this->_getPersistantData(); + } else { + $output .= '/>'; + } + return $output; + } //end func getFrozenHtml + } ?> \ No newline at end of file