Subject | Repo | Branch | Lines +/- | |
---|---|---|---|---|
Update OOUI to v0.31.0 | mediawiki/core | master | +282 -363 | |
PHP: Added server-side version of IndexLayout | oojs/ui | master | +710 -4 |
Details
Event Timeline
There is no magic, just a bunch of hardcoded HTML in PreferencesFormOOUI::getBody().
I think you want to write PHP versions of the relevant layouts/widgets, as I argued when this was implemented:
Change 493432 had a related patch set uploaded (by Cparle; owner: Cparle):
[mediawiki/extensions/WikibaseMediaInfo@master] Tabify file information and structured data
Change 493282 had a related patch set uploaded (by Jforrester; owner: Cparle):
[oojs/ui@master] PHP: Added server-side versions of IndexLayout and relations
Sounds like a good approach.
You might want to use reusePreInfuseDOM() instead, the result of which is passed to the constructor. If you use gatherPreInfuseState(), the result is passed to restorePreInfuseState(), which is only called after the infused widget is inserted into the DOM in place of the old one. In practice I suppose they would work mostly the same, but theoretically reusePreInfuseDOM()/constructor should be more efficient.
(gatherPreInfuseState()/restorePreInfuseState() was only intented for state that would be lost when we detach the PHP widget from the DOM, e.g. keyboard focus or scroll position in a <textarea>.)
reusePreInfuseDOM() also allows you to reuse the existing DOM elements, just attaching events to them etc., instead of re-generating them from nothing in JS. We've not made a lot of use of this yet, but InputWidget's $input uses it.
Alternatively, you could pick up everything that has been inserted inside the widget in PHP, and include it in the array returned by getConfig(). On a smaller scale, this is used by ActionFieldLayout and FieldLayout for their child widgets. I think the solution you proposed is better though, since this would duplicate a bunch of the HTML output.
Change 493282 merged by jenkins-bot:
[oojs/ui@master] PHP: Added server-side version of IndexLayout
Change 496356 had a related patch set uploaded (by Jforrester; owner: Jforrester):
[mediawiki/core@master] Update OOUI to v0.31.0