HTMLForm: Separate VForm code to a subclass
authorBartosz Dziewoński <matma.rex@gmail.com>
Wed, 24 Dec 2014 17:21:32 +0000 (18:21 +0100)
committerLegoktm <legoktm.wikipedia@gmail.com>
Wed, 14 Jan 2015 19:33:34 +0000 (19:33 +0000)
commitf338a1cf3132805a962909ff789ad55ba4b67f2b
tree8b26cfb6b1be225e1f094e14de56baa15bcf20b8
parent8bb0d739b3608e916a33e08baa1197e4926e52f8
HTMLForm: Separate VForm code to a subclass

…and in general, work with the existing HTMLForm design for defining
display formats, rather than against it.

Breaking changes:
* HTMLForm::isVForm() is now deprecated.
* You can no longer do this:
    $form = new HTMLForm( … );
    $form->setDisplayFormat( 'vform' ); // throws exception
  Instead, do this:
    $form = HTMLForm::factory( 'vform', … );
  When using FormSpecialPage, override the new getDisplayFormat() method
  instead of calling $form->setDisplayFormat() in the alterForm() method.
  (Other display formats are not affected, only 'vform'.)

Bug fixes:
* Correctly suppress empty labels for VForm fields
* Correctly disable <fieldset/> wrappers for VForms

Other benefits:
* Reduce code duplication related to $getFieldHtmlMethod
* Introduce HTMLForm::factory() method for constructing HTMLForms

Related cleanup:
* Correctly style 'reset' buttons in MediaWiki UI mode
* Label $wgHTMLFormAllowTableFormat as a mobile-specific hack
* Display checkboxes normally in MediaWiki UI mode (removed weird
  override that only broke things). Also, always render checkboxes
  in VForms as .mw-ui-checkbox.
* self:: → static::

Bug: T85285
Change-Id: I086a84f1c8cc6a16710709b7806c7f5f96462b32
autoload.php
includes/htmlform/HTMLCheckField.php
includes/htmlform/HTMLForm.php
includes/htmlform/HTMLFormField.php
includes/htmlform/HTMLFormFieldCloner.php
includes/htmlform/VFormHTMLForm.php [new file with mode: 0644]
includes/specialpage/FormSpecialPage.php
includes/specials/SpecialChangeEmail.php
includes/specials/SpecialPageLanguage.php
includes/specials/SpecialPasswordReset.php