jenkins-bot has submitted this change and it was merged.

Change subject: Allow message object on 
HTMLForm::setWrapperLegendMsg/setSubmitTextMsg
......................................................................


Allow message object on HTMLForm::setWrapperLegendMsg/setSubmitTextMsg

When a message needs plural support, it should be possible to parse a
message object with the params set.

Change-Id: Ifb67952b589a1821cde452b2be3f327f24e6b534
---
M includes/htmlform/HTMLForm.php
1 file changed, 10 insertions(+), 4 deletions(-)

Approvals:
  Siebrand: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/htmlform/HTMLForm.php b/includes/htmlform/HTMLForm.php
index d7c5d7f..6cf8d0a 100644
--- a/includes/htmlform/HTMLForm.php
+++ b/includes/htmlform/HTMLForm.php
@@ -1024,12 +1024,15 @@
         * Set the text for the submit button to a message
         * @since 1.19
         *
-        * @param string $msg Message key
+        * @param string|Message $msg Message key or Message object
         *
         * @return HTMLForm $this for chaining calls (since 1.20)
         */
        public function setSubmitTextMsg( $msg ) {
-               $this->setSubmitText( $this->msg( $msg )->text() );
+               if ( !$msg instanceof Message ) {
+                       $msg = $this->msg( $msg );
+               }
+               $this->setSubmitText( $msg->text() );
 
                return $this;
        }
@@ -1143,12 +1146,15 @@
         * this message as its "<legend>" element.
         * @since 1.19
         *
-        * @param string $msg Message key
+        * @param string|Message $msg Message key or Message object
         *
         * @return HTMLForm $this for chaining calls (since 1.20)
         */
        public function setWrapperLegendMsg( $msg ) {
-               $this->setWrapperLegend( $this->msg( $msg )->text() );
+               if ( !$msg instanceof Message ) {
+                       $msg = $this->msg( $msg );
+               }
+               $this->setWrapperLegend( $msg->text() );
 
                return $this;
        }

-- 
To view, visit https://gerrit.wikimedia.org/r/149618
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ifb67952b589a1821cde452b2be3f327f24e6b534
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Umherirrender <umherirrender_de...@web.de>
Gerrit-Reviewer: Addshore <addshorew...@gmail.com>
Gerrit-Reviewer: Daniel Friesen <dan...@nadir-seen-fire.com>
Gerrit-Reviewer: IAlex <coderev...@emsenhuber.ch>
Gerrit-Reviewer: Johnduhart <j...@compwhizii.net>
Gerrit-Reviewer: Nikerabbit <niklas.laxst...@gmail.com>
Gerrit-Reviewer: Siebrand <siebr...@kitano.nl>
Gerrit-Reviewer: Umherirrender <umherirrender_de...@web.de>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to