From: Kunal Mehta Date: Tue, 30 Jun 2015 20:03:58 +0000 (-0700) Subject: OOUIHTMLForm: Make setting 'readonly' on a text field actually work X-Git-Tag: 1.31.0-rc.0~10925^2~1 X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dmembres/Category:Foo?a=commitdiff_plain;h=8a164ff9f9f5b4691e40f1219358ca45c8b61c3d;p=lhc%2Fweb%2Fwiklou.git OOUIHTMLForm: Make setting 'readonly' on a text field actually work Previously 'readOnly' was set to an empty string, which casts to boolean false. Change-Id: I7d1e7f02731c7235da2ae1e0a5e3d0be2b44d978 --- diff --git a/includes/htmlform/HTMLTextField.php b/includes/htmlform/HTMLTextField.php index 9c5b8689fd..5c04ee2f19 100644 --- a/includes/htmlform/HTMLTextField.php +++ b/includes/htmlform/HTMLTextField.php @@ -113,6 +113,11 @@ class HTMLTextField extends HTMLFormField { 'tabindex' => 'tabIndex', ) ); + if ( isset( $attribs['readOnly'] ) ) { + // This needs to be set to a boolean value + $attribs['readOnly'] = true; + } + $type = $this->getType( $attribs ); return new OOUI\TextInputWidget( array(