+ /**
+ * Modifies a set of attributes meant for text input elements
+ * and apply a set of default attributes.
+ * Removes size attribute when $wgUseMediaWikiUIEverywhere enabled.
+ * @param array $attrs An attribute array.
+ * @return array $attrs A modified attribute array
+ */
+ public static function getTextInputAttributes( $attrs ) {
+ global $wgUseMediaWikiUIEverywhere;
+ if ( !$attrs ) {
+ $attrs = array();
+ }
+ if ( isset( $attrs['class'] ) ) {
+ if ( is_array( $attrs['class'] ) ) {
+ $attrs['class'][] = 'mw-ui-input';
+ } else {
+ $attrs['class'] .= ' mw-ui-input';
+ }
+ } else {
+ $attrs['class'] = 'mw-ui-input';
+ }
+ if ( $wgUseMediaWikiUIEverywhere ) {
+ // Note that size can effect the desired width rendering of mw-ui-input elements
+ // so it is removed. Left intact when mediawiki ui not enabled.
+ unset( $attrs['size'] );
+ }
+ return $attrs;
+ }
+