Page MenuHomePhabricator

Make use of Codex within Page Forms
Open, Needs TriagePublic

Description

Now that Codex is considered fully stable, it would be good to move over as much of the functionality within the Page Forms extension to use it as possible.

Here are the form input types that seem like they could be transferred to use Codex, along with their current implementation, and the Codex component they could use:

Input typeCurrent implementationCodex component
textHTMLTextInput
textareaHTMLTextArea
comboboxOOUILookup
tokensSelect2 + SortableJSChipInput (+ SortableJS?)
radiobuttonHTMLRadio
dropdownHTMLSelect
checkboxesOOUICheckbox
checkboxOOUICheckbox
dateHTMLTextInput + Select
datetimeHTMLTextInput + Select
yearHTMLTextInput

(Note that, for most of these input types, the "Current implementation" value should really have a "+ custom JavaScript" after it. Some of this custom JS can also be replaced by Codex, like the textarea input's autogrow handling.)

And here is a similar table for other form elements that could make use of Codex:

Form elementCurrent implementationCodex component
toggle (used in some helper forms)OOUIToggleSwitch
form buttonsOOUIButton
loading imageHTMLProgressBar

On the other hand, the following input types seem like they could not be converted, because there is not (currently) a Codex component for them:

  • listbox
  • tree
  • datepicker, datetimepicker
  • rating
  • googlemaps, leaflet, openlayers
  • regexp (not a true input type anyway)

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Change 1010985 had a related patch set uploaded (by Techwizzie; author: Techwizzie):

[mediawiki/extensions/PageForms@master] Make use of Codex within Page Forms

https://gerrit.wikimedia.org/r/1010985

@Yaron_Koren For some of these components, they can only be used in a Vue based setup (combobox and tokens).

Change 1012646 had a related patch set uploaded (by Techwizzie; author: Techwizzie):

[mediawiki/extensions/PageForms@REL1_41] Make use of Codex within Page Forms

https://gerrit.wikimedia.org/r/1012646

Change 1010985 abandoned by Techwizzie:

[mediawiki/extensions/PageForms@master] Make use of Codex within Page Forms

Reason:

Moving to REL1_41 - https://gerrit.wikimedia.org/r/c/mediawiki/extensions/PageForms/+/1012646

https://gerrit.wikimedia.org/r/1010985

Until T379662: [EPIC] Add Codex PHP library to Vendor is done, would it be worth adding wikimedia/codex as a requirement in PageForms' composer.json? Then we can start adding PHP-side Codex components. I'd say just wait until it's part of Core, but then it'll still be quite a while before it's available for all the MW versions that PF supports.

@Samwilson - oh, I actually didn't know that Codex was not yet bundled in with MediaWiki. That's a problem... I really don't want Page Forms to require Composer. Would it be possible for Page Forms to include its own copy of Codex? Doing that (if it's possible) would also get around versioning issues, like if Page Forms wants to make use of some Codex feature that only showed up six months ago or something.

Probably best to just wait then. Maybe a few years though!

Why don't you want to add a Composer requirement? I guess you'd have to produce your own tarballs for distribution, or use release branches and ExtensionDistributor (which actually is already linked as the PageForms download method in the infobox).

Would it be possible for Page Forms to include its own copy of Codex?

That's basically what adding it to composer.json would be. It'd be compatible with core eventually also including Codex, as long as the version constraints didn't clash (which I think they wouldn't need to).

Another approach could be to optionally use PHP Codex, if it's installed, and leave it to the wiki maintainer to add it manually to their composer.local.json.

I would just rather not have Composer dependencies for any of my extensions, because I've seen the mess that has created for Semantic MediaWiki and its family of extensions. Also, of course, including a 2nd version of Codex is a hack, no matter how it's done. I'm willing to wait - there's no real rush. I should note, though, that I think I misunderstood your comment before - you said that just the PHP version of Codex is not yet included in MediaWiki. But Page Forms can just use the JavaScript version, no?

But Page Forms can just use the JavaScript version, no?

Yes true. So perhaps a good starting point would be something like switching tokens to use MultiselectLookup for example. Getting rid of the Select2 dependency would be a nice side effect.

It also seems like each {{{field}}} would need to be a separate Codex app.

Change #1012646 abandoned by Umherirrender:

[mediawiki/extensions/PageForms@REL1_41] Make use of Codex within Page Forms

Reason:

Release is end of life

https://gerrit.wikimedia.org/r/1012646