From: umherirrender Date: Sun, 27 Jul 2014 09:48:24 +0000 (+0200) Subject: Allow message object on HTMLForm::setWrapperLegendMsg/setSubmitTextMsg X-Git-Tag: 1.31.0-rc.0~14726^2 X-Git-Url: http://git.cyclocoop.org/%27.generer_url_ecrire%28%27admin_couteau_suisse%27%2C%27cmd=descrip&outil=boites_privees?a=commitdiff_plain;h=a8d4bfaa838b7ba84d630bff42fa1fb32a8ac3fb;p=lhc%2Fweb%2Fwiklou.git 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 --- diff --git a/includes/htmlform/HTMLForm.php b/includes/htmlform/HTMLForm.php index d7c5d7f52a..6cf8d0a7eb 100644 --- a/includes/htmlform/HTMLForm.php +++ b/includes/htmlform/HTMLForm.php @@ -1024,12 +1024,15 @@ class HTMLForm extends ContextSource { * 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 @@ class HTMLForm extends ContextSource { * this message as its "" 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; }