From 99b004218830c950ba33f88ea164ac30115d1845 Mon Sep 17 00:00:00 2001 From: aude Date: Mon, 24 Dec 2012 13:34:44 +0000 Subject: [PATCH] Allow setting a form message prefix in FormSpecialPage Change-Id: Iff14a626853c98190a1aba8263b8a7ec79e9b9b5 --- includes/SpecialPage.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) 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( -- 2.20.1