From: Bartosz DziewoƄski Date: Wed, 12 Sep 2018 20:09:47 +0000 (+0200) Subject: HTMLTextField: Pass extra parameters in OOUI mode X-Git-Tag: 1.34.0-rc.0~4105^2 X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=commitdiff_plain;h=938e9402a7a66e6946db1faa30481c6fa1dcc696 HTMLTextField: Pass extra parameters in OOUI mode Some additional parameters that are passed through as attributes in HTML mode were not being passed through as config options in OOUI mode: * 'min' * 'max' * 'step' * 'title' Some have no equivalent in OOUI: * 'pattern' * 'list' * 'multiple' Also note that we support some OOUI config options that have no equivalent in HTML: * 'autosize' * 'flags' * 'indicator' I originally noticed the problem with the 'min' and 'max' params, which are clearly missing in OOUI preferences for RC and watchlist. I don't know if anything anywhere actually uses the other ones. Bug: T181844 Change-Id: I2d22ef3b08b7f0b4283b644d80bd74906177d089 --- diff --git a/includes/htmlform/fields/HTMLTextField.php b/includes/htmlform/fields/HTMLTextField.php index d988c29ba1..60c63d6a07 100644 --- a/includes/htmlform/fields/HTMLTextField.php +++ b/includes/htmlform/fields/HTMLTextField.php @@ -85,18 +85,19 @@ class HTMLTextField extends HTMLFormField { 'type', 'min', 'max', - 'pattern', - 'title', 'step', - 'list', + 'title', 'maxlength', 'tabindex', 'disabled', 'required', 'autofocus', - 'multiple', 'readonly', 'autocomplete', + // Only used in HTML mode: + 'pattern', + 'list', + 'multiple', ]; $attribs += $this->getAttributes( $allowedParams ); @@ -153,17 +154,22 @@ class HTMLTextField extends HTMLFormField { # @todo Enforce pattern, step, required, readonly on the server side as # well $allowedParams = [ + 'type', + 'min', + 'max', + 'step', + 'title', + 'maxlength', + 'tabindex', + 'disabled', + 'required', 'autofocus', + 'readonly', + 'autocomplete', + // Only used in OOUI mode: 'autosize', - 'disabled', 'flags', 'indicator', - 'maxlength', - 'readonly', - 'required', - 'tabindex', - 'type', - 'autocomplete', ]; $attribs += OOUI\Element::configFromHtmlAttributes(