Fix two typos
[lhc/web/wiklou.git] / includes / ProtectionForm.php
index 451635e..bcf4dda 100644 (file)
@@ -148,7 +148,7 @@ class ProtectionForm {
         *
         * @param string $action
         *
-        * @return string 14-char timestamp or "infinity", or false if the input was invalid
+        * @return string|false 14-char timestamp or "infinity", or false if the input was invalid
         */
        function getExpiry( $action ) {
                if ( $this->mExpirySelection[$action] == 'existing' ) {
@@ -182,10 +182,21 @@ class ProtectionForm {
                        throw new ErrorPageError( 'protect-badnamespace-title', 'protect-badnamespace-text' );
                }
 
+               $out = $this->mContext->getOutput();
+               if ( !wfMessage( 'protect-dropdown' )->inContentLanguage()->isDisabled() ) {
+                       $reasonsList = Xml::getArrayFromWikiTextList(
+                               wfMessage( 'protect-dropdown' )->inContentLanguage()->text()
+                       );
+                       $out->addModules( 'mediawiki.reasonSuggest' );
+                       $out->addJsConfigVars( [
+                               'reasons' => $reasonsList
+                       ] );
+               }
+
                if ( $this->mContext->getRequest()->wasPosted() ) {
                        if ( $this->save() ) {
                                $q = $this->mArticle->isRedirect() ? 'redirect=no' : '';
-                               $this->mContext->getOutput()->redirect( $this->mTitle->getFullURL( $q ) );
+                               $out->redirect( $this->mTitle->getFullURL( $q ) );
                        }
                } else {
                        $this->show();