HTMLForm: Refactor loading of modules required to infuse fields
[lhc/web/wiklou.git] / includes / htmlform / fields / HTMLUserTextField.php
index f21b53d..14b5e59 100644 (file)
@@ -40,8 +40,6 @@ class HTMLUserTextField extends HTMLTextField {
        }
 
        protected function getInputWidget( $params ) {
-               $this->mParent->getOutput()->addModules( 'mediawiki.widgets.UserInputWidget' );
-
                return new UserInputWidget( $params );
        }
 
@@ -49,6 +47,10 @@ class HTMLUserTextField extends HTMLTextField {
                return true;
        }
 
+       protected function getOOUIModules() {
+               return [ 'mediawiki.widgets.UserInputWidget' ];
+       }
+
        public function getInputHtml( $value ) {
                // add the required module and css class for user suggestions in non-OOUI mode
                $this->mParent->getOutput()->addModules( 'mediawiki.userSuggest' );