3 namespace MediaWiki\HTMLForm
;
6 * HTML form generation and submission handling, vertical-form style.
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 * http://www.gnu.org/copyleft/gpl.html
26 use MediaWiki\Html\Html
;
29 * Compact stacked vertical format for forms.
33 class VFormHTMLForm
extends HTMLForm
{
35 * Wrapper and its legend are never generated in VForm mode.
38 protected $mWrapperLegend = false;
41 protected $displayFormat = 'vform';
43 public static function loadInputFromParameters( $fieldname, $descriptor,
44 ?HTMLForm
$parent = null
46 $field = parent
::loadInputFromParameters( $fieldname, $descriptor, $parent );
47 $field->setShowEmptyLabel( false );
51 public function getHTML( $submitResult ) {
52 $this->getOutput()->addModuleStyles( [
54 'mediawiki.ui.button',
56 'mediawiki.ui.checkbox',
59 return parent
::getHTML( $submitResult );
65 protected function formatField( HTMLFormField
$field, $value ) {
66 return $field->getVForm( $value );
69 protected function getFormAttributes() {
70 return [ 'class' => [ 'mw-htmlform', 'mw-ui-vform', 'mw-ui-container' ] ] +
71 parent
::getFormAttributes();
74 public function wrapForm( $html ) {
75 // Always discard $this->mWrapperLegend
76 return Html
::rawElement( 'form', $this->getFormAttributes(), $html );
80 /** @deprecated class alias since 1.42 */
81 class_alias( VFormHTMLForm
::class, 'VFormHTMLForm' );