From 8a164ff9f9f5b4691e40f1219358ca45c8b61c3d Mon Sep 17 00:00:00 2001 From: Kunal Mehta Date: Tue, 30 Jun 2015 13:03:58 -0700 Subject: [PATCH] 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 --- includes/htmlform/HTMLTextField.php | 5 +++++ 1 file changed, 5 insertions(+) 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( -- 2.20.1