Set form name for HTMLForms in FormAction subclasses.
authorTyler Anthony Romeo <tylerromeo@gmail.com>
Mon, 6 Aug 2012 21:02:25 +0000 (17:02 -0400)
committerGerrit Code Review <gerrit@wikimedia.org>
Mon, 6 Aug 2012 21:11:25 +0000 (21:11 +0000)
Used FormAction::getName() to set the form name for
FormAction subclasses. Without a form name, HTMLForm
creates weird messages names for certain fields (e.g.,
in a form with sections, HTMLForm will use the message
"$prefix-$key" for the legend, but if no prefix exists,
it just becomes "-$key").

Change-Id: I1c19775e44163f4335e30f1d1f73a6e002cb57ec
Signed-off-by: Tyler Anthony Romeo <tylerromeo@gmail.com>
includes/Action.php

index a9891ec..f4343d1 100644 (file)
@@ -397,7 +397,7 @@ abstract class FormAction extends Action {
                // Give hooks a chance to alter the form, adding extra fields or text etc
                wfRunHooks( 'ActionModifyFormFields', array( $this->getName(), &$this->fields, $this->page ) );
 
-               $form = new HTMLForm( $this->fields, $this->getContext() );
+               $form = new HTMLForm( $this->fields, $this->getContext(), $this->getName() );
                $form->setSubmitCallback( array( $this, 'onSubmit' ) );
 
                // Retain query parameters (uselang etc)