From: aude Date: Mon, 24 Dec 2012 13:34:44 +0000 (+0000) Subject: Allow setting a form message prefix in FormSpecialPage X-Git-Tag: 1.31.0-rc.0~21215 X-Git-Url: http://git.cyclocoop.org/%24self?a=commitdiff_plain;h=99b004218830c950ba33f88ea164ac30115d1845;p=lhc%2Fweb%2Fwiklou.git Allow setting a form message prefix in FormSpecialPage Change-Id: Iff14a626853c98190a1aba8263b8a7ec79e9b9b5 --- diff --git a/includes/SpecialPage.php b/includes/SpecialPage.php index e844d93a8c..da150c9e6e 100644 --- a/includes/SpecialPage.php +++ b/includes/SpecialPage.php @@ -878,6 +878,16 @@ abstract class FormSpecialPage extends SpecialPage { */ protected function alterForm( HTMLForm $form ) {} + /** + * Get message prefix for HTMLForm + * + * @since 1.21 + * @return string + */ + protected function getMessagePrefix() { + return strtolower( $this->getName() ); + } + /** * Get the HTMLForm to control behaviour * @return HTMLForm|null @@ -885,11 +895,11 @@ abstract class FormSpecialPage extends SpecialPage { protected function getForm() { $this->fields = $this->getFormFields(); - $form = new HTMLForm( $this->fields, $this->getContext() ); + $form = new HTMLForm( $this->fields, $this->getContext(), $this->getMessagePrefix() ); $form->setSubmitCallback( array( $this, 'onSubmit' ) ); - $form->setWrapperLegend( $this->msg( strtolower( $this->getName() ) . '-legend' ) ); + $form->setWrapperLegend( $this->msg( $this->getMessagePrefix() . '-legend' ) ); $form->addHeaderText( - $this->msg( strtolower( $this->getName() ) . '-text' )->parseAsBlock() ); + $this->msg( $this->getMessagePrefix() . '-text' )->parseAsBlock() ); // Retain query parameters (uselang etc) $params = array_diff_key(