Reduce code duplication for parsing messages into dropdown menus
authorBartosz Dziewoński <matma.rex@gmail.com>
Wed, 12 Jul 2017 19:31:33 +0000 (21:31 +0200)
committerBartosz Dziewoński <matma.rex@gmail.com>
Tue, 12 Sep 2017 18:49:20 +0000 (20:49 +0200)
commita5c3d029c5d0f5765827d10d3fc34942a4d16853
tree16dd1e7e8eba017eb9caba4cfe0859158393c065
parentaf09cc10883257b872308729b04242b0fe8e2fb8
Reduce code duplication for parsing messages into dropdown menus

The same behavior was implemented by Xml::listDropDown(),
Article::confirmDelete() and HTMLFormField::getOptions().
A new function Xml::listDropDownOptions() is added and
all three are changed to use it.

Additionally:
* Xml::listDropDown() now uses XmlSelect internally to generate the
  dropdown HTML.
* Xml::listDropDownOptionsOoui() is introduced to handle converting
  the existing format to the OOUI format, which was previously
  duplicated in Article::confirmDelete() and HTMLFormField::getOptionsOOUI().
* This change allows HTMLForm 'select' fields (HTMLSelectField) to
  support nested options (optgroups) in OOUI mode. This is a
  prerequisite for T117781.

Bug: T117781
Change-Id: I0a088f61eb32ec59677113583c7ecdcbc3fd2af0
includes/Xml.php
includes/htmlform/HTMLFormField.php
includes/page/Article.php
tests/phpunit/includes/XmlTest.php