Commit graph

16 commits

Author SHA1 Message Date
daniel
39a6e11310 HTMLForm: accept PageReference instead of Title.
Note that this changes the effective type of the protected mCancelTarget
field. This fields has no declared type, and does not seem to be used in
any subclass. The type of mTitle is not changed at this time, but
nothing seems to rely on that either.

Bug: T278459
Change-Id: I4bf0d46c74b53ffc9cb3e6e497c789ef6b3bab6a
2021-05-07 23:36:49 +02:00
Nikki Nikkhoui
6b0e9eafe1 HTML Classes stability annotations
Add stability annotations for HTML classes.

Bug: T247862
Change-Id: I4dad7b98213ceceb8c04b24e5d52e6fecadb3538
2020-07-13 14:54:28 +02:00
James D. Forrester
ae7237ea98 Drop HTMLForm & VFormHTMLForm::isVForm(), deprecated in 1.25
Change-Id: If5f4e146071c17a9adabd36453ef68ff38405ed4
2018-03-26 10:55:41 -07:00
Bartosz Dziewoński
4fc7420fea HTMLForm: Use 'mw-htmlform' CSS class
Makes it easy to identify all HTMLForms on a page.

Change-Id: I5b9494fc925ac953c14b358331acddfe80c2661d
2016-12-18 12:59:05 +00:00
addshore
63dd31cd31 Add access modifiers to htmlform classes
Change-Id: Id8c0f0676b3200993af3cec493efc99839211bcc
2016-11-04 11:40:42 +01:00
Florian
5424788164 HTMLForm: Don't add a type=reset to links
Follow up: Ieb80e2ff36751abc6f00e2a02926fe9800666a8b

Change-Id: If88c80a46cba9729a9503b82532584443d6d5ba4
2016-06-02 22:50:55 +02:00
Gergő Tisza
0c9712c31a Improve HTMLForm (and Special:ChangeCredentials) cancel button
Add two new HTMLForm methods:
* showCancel( [bool] ) to display a cancel button
* setCancelTarget( Title|string ) to set where it should take
  the user.

The cancel button is a simple link formatted as a button.
This is faster than a real button (skips an unnecessary
submit and redirect) and avoids some UX problems:
* when clicking on a real button, HTML5 or JS  validators
  might prevent submission, which does not make sense for cancel
* form field values might get saved by the brower, which again
  does not make sense for cancelling

Use the cancel button for Special:ChangeCredentials.

Bug: T136809
Change-Id: Ieb80e2ff36751abc6f00e2a02926fe9800666a8b
2016-06-02 19:42:44 +00:00
Bartosz Dziewoński
cba7952e31 HTMLForm: Don't render 'mw-htmlform-submit-buttons' if there aren't any buttons
Visually, this only affects OOUIHTMLForm, in other kinds of forms
the element has no height anyway.

Change-Id: I90e73c49fbefec23532368848bb30b2e7b69075c
2016-04-22 14:49:51 +00:00
Ricordisamoa
1617e7822e Always use 'bool' instead of 'boolean' in Doxygen tags
Just like commit f86a5590aa

Change-Id: Ic9d08bca6524d6bb4baf5170c081ad0f3d738e28
2016-03-24 09:44:09 +01:00
Kunal Mehta
6e9b4f0e9c Convert all array() syntax to []
Per wikitech-l consensus:
 https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html

Notes:
* Disabled CallTimePassByReference due to false positives (T127163)

Change-Id: I2c8ce713ce6600a0bb7bf67537c87044c7a45c4b
2016-02-17 01:33:00 -08:00
Siebrand Mazeland
950910dc99 Fix PHPCS warnings in includes/htmlform/
Change-Id: Ifbf050c92a84d6af59709632965f48f3d567c0da
2015-09-28 13:35:28 +02:00
Florian
3f7443df86 HTMLForm: Allow to set the primary flag for submit buttons
Currently, every submit button generated by HTMLForm itself (not via
the descriptor) doesn't have the primary flag and there is no (easy) way
to add it, although this generated submit button is most likely the primary
one.

Add a new function HTMLForm::setSubmitPrimary() to allow a form to set
add the primary flag to this submit button.

Change-Id: I3ce363f995389a87764edb586b4b64ab2b77b0db
2015-07-23 21:48:35 +02:00
Bartosz Dziewoński
b524a4333f OOUIHTMLForm: Support setWrapperLegend()
Changed FormSpecialPage not to call setWrapperLegend() for OOUI
forms to preserve current default behavior.

Bonus:
* Correct documentation of setWrapperLegend() to state that it
  HTML-escapes legend text.
* Remove hard-coded class="visualClear" in getFormAttributes().
* Allow setWrapperLegend( true ) to display the wrapper without
  legend text.
* Rejigger things so that we can put the legend and "header HTML"
  into correct order.

Bug: T103026
Change-Id: I847c5e18ae5469aa3a68cc9fa37b2a6614476ca2
2015-07-13 19:20:08 +02:00
Bartosz Dziewoński
552568c63d OOUIHTMLForm: Correctly handle submit modifier flags
Rejigger some HTMLForm internals to remove the hardcoded assumption of
using 'mw-ui' classes.

Bug: T98903
Change-Id: Icc20453c999c761b87e19a71ccd43d93b9c1bfa7
2015-06-27 13:14:08 +00:00
Bartosz Dziewoński
9172be5a0c HTMLForm: Add wfDeprecated to isVForm
Change-Id: Idd8eb9cf63794c5a71439c130ad28564e6d3e750
2015-05-01 22:17:50 +00:00
Bartosz Dziewoński
f338a1cf31 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
2015-01-14 19:33:34 +00:00