Page MenuHomePhabricator

enableOOUI() not possible for Tag extensions
Closed, ResolvedPublic


Consider the following use case:

An extension (e.g. InputBox) creates input fields, if a special parser tag is added in wikitext. Currently OOJs UI in core can be easily enabled with OutputPage::enableOOUI(). For these extensions it isn't easily possible to add OOUI elements in the parser function. As a workaround they could enableOOUI via:


which would workaround a fatal error, which would throw, if you use any OOUI element without setting a theme.

But if a user views a page, the form will be unstyled, because the oojs-ui Resource modules aren't added to OutputPage when the page is viewed. This could be fixed by another workaround, by using the OutputPageParserOutput hook:

public static function onOutputPageParserOutput( OutputPage &$out, ParserOutput $parserOutput ) {
	if ( $parserOutput->getProperty( 'enableOOUI' ) ) {

Both workarounds work very well, but it feels a bit bad to let extensions handle this anytime again. There should be a better approach, e.g.:

  • enableOOUI() in ParserOutput, too, which enables OOUI
  • enableOOUI() set's the 'enableOOUI' property by itself (or any other reasonable property)
  • if enableOOUI() is set, OutputPage should enable OOUI by itself, when the ParserOutput object is added to it

Event Timeline

Florian created this task.Jul 25 2015, 3:08 PM
Florian raised the priority of this task from to Medium.
Florian updated the task description. (Show Details)
Florian added subscribers: Florian, Aklapper, Jdforrester-WMF and 6 others.

Change 226981 had a related patch set uploaded (by Florianschmidtwelzow):
Allow to enable OOUI via a parser tag extension

Prtksxna removed a subscriber: Prtksxna.Jul 27 2015, 3:59 PM
matmarex closed this task as Resolved.Aug 6 2015, 8:32 AM
matmarex assigned this task to Florian.
matmarex removed a project: Patch-For-Review.
matmarex set Security to None.

Change 226981 merged by jenkins-bot:
Allow to enable OOUI via a parser tag extension