aboutsummaryrefslogtreecommitdiffstats
path: root/includes/htmlform/fields/HTMLRadioField.php
Commit message (Collapse)AuthorAgeFilesLines
* HTMLFormField: factor out label escapingTim Starling2025-02-131-7/+5
| | | | | | | Provide protected helper methods for conditional escaping of labels. Complain about the situation in a comment. Change-Id: I32b3ebc5eb2d0892f2204a09a74ed00ee5274811
* Replace call_user_func with dynamic function callUmherirrender2025-02-131-2/+2
| | | | | | | | Use modern php syntax to call a callable. Reduce the stack trace to improve performance and better IDE and static analyzer support Change-Id: I9ef131032a662a3b8db69aa7079dbd51f88f575a
* HTMLRadioField: clean up HTMLlwatson2024-08-121-1/+1
| | | | | | | | | | | | | | Ensure CodexHTMLForm reflects HTML changes made to Codex components, Radio and Checkbox. - Changed the top level element from `span` to `div` in HTMLRadioField. - Update test in HTMLRadioFieldTest. HTMLCheckboxField already has a top-level `div` so no changes are needed. Bug: T370689 Change-Id: I0b7e5369e23b1a95e431014d7b22f3f1064b3dba
* Import InvalidArgumentException at top of the sourceEbrahim Byagowi2024-05-191-2/+3
| | | | | | | | | | | | | | It was asked in a patch review to apply fully import InvalidArgumentException where possible. I was guessing some of my other already merged patches have but turned out such thing exists other places style so for the sake of consistency I've turned rest of inline import of the specific exception at top of the file. There are instances of source files that aren't in any namespace but have fully qualified import which this patch doesn't touch. Change-Id: I4071fc698b65746d9594cf4d5f45bae82843d436
* Add namespace and deprecation alias to Xml and XmlSelectEbrahim Byagowi2024-05-161-1/+1
| | | | | | | | | | This patch introduces a new namespace declaration, MediaWiki\Xml and adds Xml and XmlSelect to it and establishes class aliases marked as deprecated since version 1.43. Bug: T353458 Change-Id: I45cccd540b6e15f267d3ab588a064fbeb719d921
* HTMLRadioField: Fix escaping of options with CodexDaimona Eaytoy2024-03-291-2/+3
| | | | | | | | | | | | | | | | `$this->mOptionsLabelsNotFromMessage` is set when calling `$this->getOptions()`, meaning the previous code wasn't actually seeing its expected value. Compare with the `getInputOOUI` implementation, where the ternary is inside the foreach loop. So, do the same thing for Codex and choose the function to use inside the loop. Also use the full method name in both cases instead of indirect calls, as it makes the code easier to analyze statically (also, the call itself is pretty simple). Follow-up to I73b2e95cff. Change-Id: Ie6b626fa4f9822f76bf202c5ed66ec16c17dc422
* HTMLRadioField: Escape plain text description messagesRoan Kattouw2024-03-251-1/+1
| | | | Change-Id: I40c7f93ac5ba71a6a3c8a1caa15da6a6be7e331b
* HTMLForm: Add per-option descriptions for Codex radio buttonsRoan Kattouw2024-03-211-3/+70
| | | | | | | | | | | | | Add the 'option-descriptions', option-descriptions-messages' and 'option-descriptions-messages-parse' settings to HTMLRadioField, which allow setting descriptions for each option. For simplicity, only support this for HTMLRadioField, and only for Codex. See also T324268 for a previous stalled attempt to implement this for OOUI, which ran into issues. Bug: T359019 Change-Id: I38116bb2fa3086408d3e2b47e5fe020b30f9729a
* Merge "HTMLFormField: Codex CSS-only version of HTMLRadioField"jenkins-bot2024-03-191-1/+57
|\
| * HTMLFormField: Codex CSS-only version of HTMLRadioFieldlwatson2024-03-191-1/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | Adds a CSS-only version of Codex Radio via HTMLRadioField. Iterates through the list of options obtained from `getOptions()` and generates the HTML markup for each radio input, radio icon, and radio label. The three elements (input, icon, label) combined make a single Codex Radio. The Radios are appended to an empty `$html` string variable. The function returns the concatenated HTML markup. Bug: T359015 Change-Id: I73b2e95cff0bc50ba1bc70457d65e286592288ac
* | Standardise all our class alias deprecation comments for ease of greppingJames D. Forrester2024-03-191-1/+1
|/ | | | Change-Id: I7f85d931d3b79da23e87b4e5692b2e14be8fcaa0
* Namespace HTMLForm and friendsJames D. Forrester2024-02-141-3/+10
| | | | | Bug: T353458 Change-Id: I09e66c3223018ec47e0549ee7f6a590b676f4eef
* Namespace Sanitizer under \MediaWiki\ParserJames D. Forrester2023-09-211-0/+1
| | | | | Bug: T166010 Change-Id: Id13dcbf7a0372017495958dbc4f601f40c122508
* Special:ListFiles: UX improvementsHannah Okwelum2023-08-131-0/+3
| | | | | | | | See T194067 for what this patch is supposed to fix, additionally, We introduced a new method to escape the result of `getLimitSelectList()` in ImageListPager because phan was shouting. In HTMLRadioField.php on line 67, I converted the label value to a string because HtmlSnippet accepts only a string Bug: T194067 Change-Id: I9cc81df0d3225dce4dca50361be9e2561e50e260
* Drop mw-ui-radio markupJon Robson2023-05-121-6/+0
| | | | | | | | | The HTMLRadioField is seldom used, and never inside an HTMLVForm and never without OOUI so this code is serving no purpose. Bug: T182050 Change-Id: I51e54058194cf1bc8398dc78136423d10108a0e9
* Reorg: Move HTML-related classes out of includes/ to Html/Amir Sarabadani2023-02-161-0/+1
| | | | | Bug: T321882 Change-Id: I5dc1f7e9c303cd3f5b9dd7010d6bb470d8400a18
* htmlform: Use ContextSource to get configUmherirrender2022-05-301-3/+1
| | | | Change-Id: I759e7d23822e6c435ec3d6010bf4e21ace0c9ce8
* Use MainConfigNames instead of string literals, #3Aryeh Gregor2022-04-261-1/+2
| | | | | | | | | | | | | This edition brought to you by: grep -ERIn $(grep -o "'[A-Za-z0-9_]*'" includes/MainConfigNames.php | tr "\n" '|' | sed 's/|$/\n/') includes/ I only corrected a fraction of the results provided by that command. I'm submitting the partial patch now so it doesn't bitrot. Bug: T305805 Change-Id: If1918c0b3d88cdf90403921e4310740e206d6962
* Refactor global variables to use MediaWikiServices insteadTChin2022-01-101-2/+5
| | | | | | | | | | | | Automatically refactors wg prefixed globals to use MediaWikiServices config using Rector. Doesn't include files that set globals or files that fail CI. Rector Gist: https://gist.github.com/tchin25/7cc54f6d23aedef010b22e4dfbead228 * This patch uses a modified source code rector library for our specific use case and the rector will have different effects without it. A writeup for future reference is here: https://meta.wikimedia.org/wiki/User:TChin_(WMF)/Using_Rector_On_MediaWiki Change-Id: I1a691f01cd82e60bf41207d32501edb4b9835e37
* Fix typos in comments (E-H)Siddharth VP2021-12-301-1/+1
| | | | Change-Id: I0748e0d5962fa909fdd6b7fcae4ab259bde4cdf1
* build: Enable phan-taint-check-plugin and suppress issuesUmherirrender2020-12-301-0/+1
| | | | | | | | | | | | | | | | | | Taint check checks for possible security issues by tracking html escaping and more by using phan. This slows done the phan-job a bit and requires more ram Keep the DoubleEscaped issues out to make reviewer easier Adds suppression for false positives Adds taint-annotation to help taint-check Removes suppression for code phan now understand better by the tracking of keys in taint-check Fix some small issues by adding int cast or htmlspecialchars calls Bug: T216348 Bug: T268920 Change-Id: I849ac4f120fd15b483e8939d4db45c98dc351259
* HTML Classes stability annotationsNikki Nikkhoui2020-07-131-0/+3
| | | | | | | Add stability annotations for HTML classes. Bug: T247862 Change-Id: I4dad7b98213ceceb8c04b24e5d52e6fecadb3538
* Use \u{00A0} instead of   or  Fomafix2018-06-241-1/+1
| | | | | | | | | | | | | 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
* Use ::class to resolve class names in includes filesUmherirrender2018-01-271-1/+1
| | | | | | | This helps to find renamed or misspelled classes earlier. Phan will check the class names Change-Id: I07a925c2a9404b0865e8a8703864ded9d14aa769
* HTMLRadioField: Do not automatically infuse our RadioSelectInputWidgetsBartosz Dziewoński2017-11-161-4/+0
| | | | | | | | | | | | | | | | | | | | | | This is really a workaround for an issue in a completely different place: JS RadioSelectInputWidget internally uses `<input type="hidden">` rather than real radio buttons, which does not work correctly with the code in mediawiki.special.preferences.confirmClose.js. Ideally we would change RadioSelectInputWidget to not do such weird things. However, I think this is actually a good thing to do in general. From the user's perspective, PHP RadioSelectInputWidget and JS RadioSelectInputWidget look and behave the same, so there's no reason to infuse and rebuild them. This behavior was implemented in f50cee1375201a5d3fd76c0c262cfc7e66bd5d42 in which unfortunately I did not document the reason for it. For other fields it makes obvious sense (the JS widgets have improvements like autocompletion, or at least look "pretty"), but I have no idea why I did it for this one. Bug: T180643 Change-Id: I53e50f8cda39466b2396b374e642c154487888bb
* Human-readable section ID supportMax Semenik2017-08-011-1/+1
| | | | | | | | | | | | | | | | It adds the ability to replace the current section ID escaping schema (.C0.DE) with a HTML5-compliant escaping schema that is displayed as Unicode in many modern browsers. See the linked bug for discussion of various options that were considered before the implementation. A few remarks: * Because Sanitizer::escapeId() is used in a bunch of places without escaping, I'm deprecating it without altering its behavior. * The bug described in comments for Parser::guessLegacySectionNameFromWikiText() is still there in some Edge versions that display mojibake. Bug: T152540 Change-Id: Id304010a0342efbb7ef2d56c5b8b244f2e4fb2c5
* HTMLForm: Allow returning Message objects from HTMLFormField::validate()Brad Jorsch2016-11-141-2/+2
| | | | | | | It mostly already worked. HTMLForm::trySubmit() needed a little adjustment to handle things properly. Change-Id: Ibb17bb61ac0b2d41953249980bc2f23b8a3ae5b6
* Add access modifiers to htmlform classesaddshore2016-11-041-4/+4
| | | | Change-Id: Id8c0f0676b3200993af3cec493efc99839211bcc
* Merge "Display an error message when the validataion of a radio input fails ↵jenkins-bot2016-09-111-1/+1
|\ | | | | | | because user did not provide any input."
| * Display an error message when the validataion of a radio input fails because ↵Huji Lee2016-09-111-1/+1
| | | | | | | | | | | | | | user did not provide any input. Bug: T107486 Change-Id: Ie3a9cc11f285cadec1dde32f820643d1aabd0d1b
* | HTMLFormField: Move 'flatlist' handling to fields that use it and documentBartosz Dziewoński2016-08-241-0/+15
| | | | | | | | Change-Id: I5dc6ad71880a741c41757bc64d236971edfbabfa
* | Do not automatically infuse any OOjs UI widgetsBartosz Dziewoński2016-08-191-0/+4
|/ | | | | | | | | | | | | | | | | | | | | | | | | This is not really what we had in mind when developing the infusion feature and I think it's not helpful. Most of the time there is just no benefit; a ButtonWidget generated in PHP and in JS behaves and looks pretty much the same, and rebuilding it through infusion is a small performance hit. If you're not adding any event handlers, it only makes sense for various dropdowns, which have themed styling. For the primary use case of adding JS behaviors to PHP widgets you need to call OO.ui.infuse() anyway to get a reference to the JS widget, and not infusing automatically should make it easier to reason about your code. Infusion tries to be very transparent, but it can't hide the fact that the DOM is re-built, making your references to DOM nodes from before infusion useless and losing anything from PHP that wasn't included in the config (e.g. custom attributes). This commit removes automated infusion from mediawiki.page.ready and adds some custom code in mediawiki.special.movePage and mediawiki.htmlform. I see only two extensions using infusable OOjs UI widgets in Gerrit (ArticlePlaceholder and ExtensionDistributor) and neither should be affected by this change. Change-Id: I56608c537fc57c5c54960b0603694f2612f45618
* Move HTMLFormField subclasses to a separate directoryBartosz Dziewoński2016-08-011-0/+96
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