From 3ec55b9e0a57c648dca169545303d4c87a266444 Mon Sep 17 00:00:00 2001 From: Ankit Agarwal Date: Tue, 20 Mar 2012 15:09:15 +0800 Subject: [PATCH] MDL-30845 accessibility: changing the way input fields are rendered when they are not-editable --- lib/form/text.php | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/lib/form/text.php b/lib/form/text.php index 307c4f6c311..1da375d5cf7 100644 --- a/lib/form/text.php +++ b/lib/form/text.php @@ -64,6 +64,19 @@ class MoodleQuickForm_text extends HTML_QuickForm_text{ $this->_hiddenLabel = $hiddenLabel; } + /** + * Returns the html to be used when the element is frozen + * + * @since 2.4 + * @return string Frozen html + */ + function getFrozenHtml() + { + $attributes = array('readonly' => 'readonly'); + $this->updateAttributes($attributes); + return $this->_getTabs() . '_getAttrString($this->_attributes) . ' />' . $this->_getPersistantData(); + } //end func getFrozenHtml + /** * Returns HTML for this form element. * @@ -88,18 +101,4 @@ class MoodleQuickForm_text extends HTML_QuickForm_text{ return $this->_helpbutton; } - /** - * 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'; - } - } }