Commit graph

18 commits

Author SHA1 Message Date
Alangi Derick
f6fcb74728 htmlform: Fix multiple PHPDoc annotations in htmlform module
- Add @param annotation for $params variable for __construct() method
  in the HTMLExpiryField class.
- Add @throws annotation for getOptionsOOUI() method that throws a
  MWException and remove "@return array" as this method only throw an
  exception now.

Change-Id: I292f6ae04b840f6f6f74b7c92f834f056659fbe2
2018-12-03 12:48:53 +00:00
Fomafix
43244db9a2 Use PHP 7 '??' operator instead of if-then-else
Change-Id: If9d4be5d88c8927f63cbb84dfc8181baf62ea3eb
2018-10-21 21:46:46 +02:00
James D. Forrester
6c6efe54ec HTMLForm: Drop this never-used backwards-compatibility
Change-Id: I6864d3a1207de44d465491baad87cb9c00714255
2018-09-12 13:14:18 -07:00
Bartosz Dziewoński
098fd0dcb3 HTMLMultiSelectField: Improve compat with GET forms with no wpFormIdentifier
Now it behaves more like HTMLCheckField: if there is clearly a value
submitted, it will load it.

Setting wpFormIdentifier is still needed for forms with default-on
checkboxes (without form identifier, it is impossible to distinguish a
page view without form submission, and form submission with default-on
checkbox unchecked).

In particular, this fixes the 'Show additional logs' checkboxes on
Special:Log: they no longer get unchecked after form submission.

Change-Id: Ief74a7e424b37ccd44759133b3cb8665275314a6
2018-07-18 20:10:04 +02:00
Fomafix
125cbd8c01 Use \u{00A0} instead of   or  
Directly use the UTF-8 encoding of the 'NO-BREAK SPACE' (U+00A0) instead of
the HTML/XML entities   or   or  .

With the UTF-8 character the generated HTML is shorter and better to read.

Also change the special value for the label in HTMLForm from   to
U+00A0 but also support   for backward compability.

Bug: T154300
Change-Id: I882599ac1120789bb4e524c4394870680caca4f4
2018-06-24 01:20:13 +00:00
Umherirrender
3124a990a2 Use ::class to resolve class names in includes files
This helps to find renamed or misspelled classes earlier.
Phan will check the class names

Change-Id: I07a925c2a9404b0865e8a8703864ded9d14aa769
2018-01-27 20:34:29 +01:00
Bartosz Dziewoński
f752323054 HTMLMultiSelectField: Allow formatting in section headings in OOUI mode
Follow-up to 5a113417e5.
It is allowed in non-OOUI modes.

Bug: T181698
Change-Id: Ib2ebcd1a92f1b02a528787fe3fd1f5452b9808c4
2017-11-30 17:38:30 +01:00
Bartosz Dziewoński
a81db83d79 HTMLMultiSelectField: Fix OOUI\CheckboxMultiselectInputWidget to be infusable again
Regression from 5a113417e5.

Bug: T180677
Change-Id: Id1b0ebe9d9a56a76d73deb2b4d17213ae5e45a04
2017-11-16 11:51:58 +01:00
Bartosz Dziewoński
5a113417e5 HTMLMultiSelectField: Support sections in OOUI mode
The resulting HTML makes very little sense semantically, but no
worries, because so does the existing one for non-OOUI forms.

Change-Id: I99bf6341c58869f6322b9d9c780d9c66739d00b6
2017-09-28 14:17:05 +02:00
Bartosz Dziewoński
8c1a1a62a1 Avoid duplicate accesskey hints on OOUI widgets
Values returned by `Linker::tooltipAndAccesskeyAttribs()` and
`Linker::titleAttrib( ..., 'withaccess' )` include an accesskey
hint in the title text. This is unnecessary when used for OOjs UI
widgets, since after the changes from T168408 they display an
accesskey hint automatically.

Also fixed some other accesskey bugs in HTMLForm which probably
no one ever ran into.

Bug: T168408
Change-Id: I63285b5bce3341875a6d82eba059623bf105ca62
2017-08-01 20:59:13 +00:00
Huji Lee
c96166173e HTMLMultiSelect parameter to specify which options are disabled
Depends on I32fa20e4adb23960d9db6bf6023f79bf128fb600

Bug: T153751
Change-Id: I3bcf6720c960e0be962e0f3f37a22ec8778db1d1
2017-03-07 22:16:37 +01:00
Erik Bernhardson
d67197fa11 Cleanup some incorrect return annotations
Most of these are simply changing annotations to reflect
reality. If a function can return false to indicate failure
the @return should indicate it.

Some are fixing preg_match calls, preg match returns 1, 0 or false,
but the functions all claim to return booleans.

This is far from all the incorrect return types in mediawiki, there
are around 250 detected by phan, but have to start somewhere.

Change-Id: I1bbdfee6190747bde460f8a7084212ccafe169ef
2016-12-12 10:15:05 -08:00
Brad Jorsch
7fdbe15fb6 HTMLForm: Allow returning Message objects from HTMLFormField::validate()
It mostly already worked. HTMLForm::trySubmit() needed a little
adjustment to handle things properly.

Change-Id: Ibb17bb61ac0b2d41953249980bc2f23b8a3ae5b6
2016-11-14 13:25:14 -05:00
addshore
63dd31cd31 Add access modifiers to htmlform classes
Change-Id: Id8c0f0676b3200993af3cec493efc99839211bcc
2016-11-04 11:40:42 +01:00
Bartosz Dziewoński
96ef35a58a HTMLForm: Add OOUI support for 'multiselect' with 'dropdown' => true
Using CapsuleMultiselectWidget.

Change-Id: I816739bc3acd40ee9d8b67e19ff3e4296fce66d3
2016-10-04 19:50:44 +02:00
Bartosz Dziewoński
d23ebca2b9 HTMLFormField: Move 'flatlist' handling to fields that use it and document
Change-Id: I5dc6ad71880a741c41757bc64d236971edfbabfa
2016-08-24 15:22:32 +00:00
Bartosz Dziewoński
7191028ade HTMLMultiSelectField: Add 'dropdown' option for 'mw-chosen' behavior and document
Previously, you could pass 'cssclass' => 'mw-chosen' in the form
descriptor for a 'multiselect' field, and it'd be automatically
converted to a text field with a dropdown allowing values to be
selected. This is not very intuitive (unless you know what the Chosen
library is) and was not documented anywhere except for release notes.

The new recommended and documented way to achieve this is by passing
'dropdown' => true. Old way is supported for backwards compatibility.

Also, add the 'jquery.chosen' module to the page server-side.

Change-Id: I3a025e1c3c7571e930a35e020d73d558fdc433d0
2016-08-22 17:58:53 +00:00
Bartosz Dziewoński
15692fa6d4 Move HTMLFormField subclasses to a separate directory
It's getting more difficult to navigate the files in includes/htmlform/
with every new field and every new helper class that is being added.

Change-Id: I92ce2356baf6151f17b2440970d5abdf86503820
2016-08-01 07:58:56 +00:00
Renamed from includes/htmlform/HTMLMultiSelectField.php (Browse further)