10namespace MediaWiki\HTMLForm;
13use InvalidArgumentException;
15use MediaWiki\Context\ContextSource;
16use MediaWiki\Context\IContextSource;
17use MediaWiki\HookContainer\ProtectedHookAccessorTrait;
18use MediaWiki\Html\Html;
19use MediaWiki\HTMLForm\Field\HTMLApiField;
20use MediaWiki\HTMLForm\Field\HTMLAutoCompleteSelectField;
21use MediaWiki\HTMLForm\Field\HTMLButtonField;
22use MediaWiki\HTMLForm\Field\HTMLCheckField;
23use MediaWiki\HTMLForm\Field\HTMLCheckMatrix;
24use MediaWiki\HTMLForm\Field\HTMLComboboxField;
25use MediaWiki\HTMLForm\Field\HTMLDateTimeField;
26use MediaWiki\HTMLForm\Field\HTMLEditTools;
27use MediaWiki\HTMLForm\Field\HTMLExpiryField;
28use MediaWiki\HTMLForm\Field\HTMLFileField;
29use MediaWiki\HTMLForm\Field\HTMLFloatField;
30use MediaWiki\HTMLForm\Field\HTMLFormFieldCloner;
31use MediaWiki\HTMLForm\Field\HTMLHiddenField;
32use MediaWiki\HTMLForm\Field\HTMLInfoField;
33use MediaWiki\HTMLForm\Field\HTMLIntField;
34use MediaWiki\HTMLForm\Field\HTMLMultiSelectField;
35use MediaWiki\HTMLForm\Field\HTMLNamespacesMultiselectField;
36use MediaWiki\HTMLForm\Field\HTMLOrderedMultiselectField;
37use MediaWiki\HTMLForm\Field\HTMLRadioField;
38use MediaWiki\HTMLForm\Field\HTMLSelectAndOtherField;
39use MediaWiki\HTMLForm\Field\HTMLSelectField;
40use MediaWiki\HTMLForm\Field\HTMLSelectLanguageField;
41use MediaWiki\HTMLForm\Field\HTMLSelectLimitField;
42use MediaWiki\HTMLForm\Field\HTMLSelectNamespace;
43use MediaWiki\HTMLForm\Field\HTMLSelectNamespaceWithButton;
44use MediaWiki\HTMLForm\Field\HTMLSelectOrOtherField;
45use MediaWiki\HTMLForm\Field\HTMLSizeFilterField;
46use MediaWiki\HTMLForm\Field\HTMLSubmitField;
47use MediaWiki\HTMLForm\Field\HTMLTagFilter;
48use MediaWiki\HTMLForm\Field\HTMLTagMultiselectField;
49use MediaWiki\HTMLForm\Field\HTMLTextAreaField;
50use MediaWiki\HTMLForm\Field\HTMLTextField;
51use MediaWiki\HTMLForm\Field\HTMLTextFieldWithButton;
52use MediaWiki\HTMLForm\Field\HTMLTimezoneField;
53use MediaWiki\HTMLForm\Field\HTMLTitlesMultiselectField;
54use MediaWiki\HTMLForm\Field\HTMLTitleTextField;
55use MediaWiki\HTMLForm\Field\HTMLUsersMultiselectField;
56use MediaWiki\HTMLForm\Field\HTMLUserTextField;
57use MediaWiki\Linker\Linker;
58use MediaWiki\Linker\LinkTarget;
59use MediaWiki\MainConfigNames;
60use MediaWiki\Message\Message;
61use MediaWiki\Page\PageReference;
62use MediaWiki\Parser\Sanitizer;
63use MediaWiki\Session\CsrfTokenSet;
64use MediaWiki\Status\Status;
65use MediaWiki\Title\Title;
66use MediaWiki\Title\TitleValue;
69use Wikimedia\Message\MessageParam;
70use Wikimedia\Message\MessageSpecifier;
215 use ProtectedHookAccessorTrait;
219 'api' => HTMLApiField::class,
220 'text' => HTMLTextField::class,
221 'textwithbutton' => HTMLTextFieldWithButton::class,
222 'textarea' => HTMLTextAreaField::class,
223 'select' => HTMLSelectField::class,
224 'combobox' => HTMLComboboxField::class,
225 'radio' => HTMLRadioField::class,
226 'multiselect' => HTMLMultiSelectField::class,
227 'limitselect' => HTMLSelectLimitField::class,
228 'check' => HTMLCheckField::class,
229 'toggle' => HTMLCheckField::class,
230 'int' => HTMLIntField::class,
231 'file' => HTMLFileField::class,
232 'float' => HTMLFloatField::class,
233 'info' => HTMLInfoField::class,
234 'selectorother' => HTMLSelectOrOtherField::class,
235 'selectandother' => HTMLSelectAndOtherField::class,
236 'namespaceselect' => HTMLSelectNamespace::class,
237 'namespaceselectwithbutton' => HTMLSelectNamespaceWithButton::class,
238 'tagfilter' => HTMLTagFilter::class,
239 'sizefilter' => HTMLSizeFilterField::class,
240 'button' => HTMLButtonField::class,
241 'submit' => HTMLSubmitField::class,
242 'hidden' => HTMLHiddenField::class,
243 'edittools' => HTMLEditTools::class,
244 'checkmatrix' => HTMLCheckMatrix::class,
245 'cloner' => HTMLFormFieldCloner::class,
246 'autocompleteselect' => HTMLAutoCompleteSelectField::class,
247 'language' => HTMLSelectLanguageField::class,
248 'date' => HTMLDateTimeField::class,
249 'time' => HTMLDateTimeField::class,
250 'datetime' => HTMLDateTimeField::class,
251 'expiry' => HTMLExpiryField::class,
252 'timezone' => HTMLTimezoneField::class,
256 'email' => HTMLTextField::class,
257 'password' => HTMLTextField::class,
258 'url' => HTMLTextField::class,
259 'title' => HTMLTitleTextField::class,
260 'user' => HTMLUserTextField::class,
261 'tagmultiselect' => HTMLTagMultiselectField::class,
262 'orderedmultiselect' => HTMLOrderedMultiselectField::class,
263 'usersmultiselect' => HTMLUsersMultiselectField::class,
264 'titlesmultiselect' => HTMLTitlesMultiselectField::class,
265 'namespacesmultiselect' => HTMLNamespacesMultiselectField::class,
444 private $hiddenTitleAddedToForm =
false;
464 return new CodexHTMLForm( $descriptor, $context, $messagePrefix );
466 return new OOUIHTMLForm( $descriptor, $context, $messagePrefix );
468 $form =
new self( $descriptor, $context, $messagePrefix );
489 $this->mMessagePrefix = $messagePrefix;
503 $loadedDescriptor = [];
505 foreach ( $descriptor as $fieldname => $info ) {
506 $section = $info[
'section'] ??
'';
508 if ( isset( $info[
'type'] ) && $info[
'type'] ===
'file' ) {
509 $this->mUseMultipart =
true;
512 $field = static::loadInputFromParameters( $fieldname, $info, $this );
514 $setSection =& $loadedDescriptor;
516 foreach ( explode(
'/', $section ) as $newName ) {
517 $setSection[$newName] ??= [];
518 $setSection =& $setSection[$newName];
522 $setSection[$fieldname] = $field;
523 $this->mFlatFields[$fieldname] = $field;
526 $this->mFieldTree = array_merge_recursive( $this->mFieldTree, $loadedDescriptor );
536 return isset( $this->mFlatFields[$fieldname] );
545 if ( !$this->
hasField( $fieldname ) ) {
546 throw new DomainException( __METHOD__ .
': no field named ' . $fieldname );
548 return $this->mFlatFields[$fieldname];
562 in_array( $format, $this->availableSubclassDisplayFormats,
true ) ||
563 in_array( $this->displayFormat, $this->availableSubclassDisplayFormats,
true )
565 throw new LogicException(
'Cannot change display format after creation, ' .
566 'use HTMLForm::factory() instead' );
569 if ( !in_array( $format, $this->availableDisplayFormats,
true ) ) {
570 throw new InvalidArgumentException(
'Display format must be one of ' .
573 $this->availableDisplayFormats,
574 $this->availableSubclassDisplayFormats
580 $this->displayFormat = $format;
611 if ( isset( $descriptor[
'class'] ) ) {
612 $class = $descriptor[
'class'];
613 } elseif ( isset( $descriptor[
'type'] ) ) {
614 $class = static::$typeMappings[$descriptor[
'type']];
615 $descriptor[
'class'] = $class;
621 throw new InvalidArgumentException(
"Descriptor with no class for $fieldname: "
622 . print_r( $descriptor,
true ) );
640 $class = static::getClassFromDescriptor( $fieldname, $descriptor );
642 $descriptor[
'fieldname'] = $fieldname;
643 $descriptor[
'parent'] = $parent;
645 # @todo This will throw a fatal error whenever someone try to use
646 # 'class' to feed a CSS class instead of 'cssclass'. Would be
647 # great to avoid the fatal error and show a nice error.
648 return new $class( $descriptor );
660 # Load data from the request.
662 $this->mFormIdentifier ===
null ||
663 $this->
getRequest()->getVal(
'wpFormIdentifier' ) === $this->mFormIdentifier ||
664 ( $this->mSingleForm && $this->
getMethod() ===
'get' )
668 $this->mFieldData = [];
681 $this->mWasSubmitted =
true;
695 if ( $this->mFormIdentifier === null ) {
704 } elseif ( $this->
getRequest()->wasPosted() ) {
705 $editToken = $this->
getRequest()->getVal(
'wpEditToken' );
706 if ( $this->
getUser()->isRegistered() || $editToken !==
null ) {
711 CsrfTokenSet::DEFAULT_FIELD_NAME, $this->mTokenSalt
717 return $identOkay && $tokenOkay;
731 if ( $result ===
true || ( $result instanceof
Status && $result->
isGood() ) ) {
768 $hoistedErrors = Status::newGood();
769 if ( $this->mValidationErrorMessage ) {
770 foreach ( $this->mValidationErrorMessage as $error ) {
771 $hoistedErrors->fatal( ...$error );
774 $hoistedErrors->fatal(
'htmlform-invalid-input' );
777 $this->mWasSubmitted =
true;
779 # Check for cancelled submission
780 foreach ( $this->mFlatFields as $fieldname => $field ) {
781 if ( !array_key_exists( $fieldname, $this->mFieldData ) ) {
784 if ( $field->cancelSubmit( $this->mFieldData[$fieldname], $this->mFieldData ) ) {
785 $this->mWasSubmitted =
false;
790 # Check for validation
791 $hasNonDefault =
false;
792 foreach ( $this->mFlatFields as $fieldname => $field ) {
793 if ( !array_key_exists( $fieldname, $this->mFieldData ) ) {
796 $hasNonDefault = $hasNonDefault || $this->mFieldData[$fieldname] !== $field->getDefault();
797 if ( $field->isDisabled( $this->mFieldData ) ) {
800 $res = $field->validate( $this->mFieldData[$fieldname], $this->mFieldData );
801 if ( $res !==
true ) {
803 if ( $res !==
false && !$field->canDisplayErrors() ) {
804 if ( is_string( $res ) ) {
805 $hoistedErrors->fatal(
'rawmessage', $res );
807 $hoistedErrors->fatal( $res );
815 if ( !$hasNonDefault && $this->
getMethod() ===
'get' &&
816 ( $this->mFormIdentifier ===
null ||
817 $this->
getRequest()->getCheck(
'wpFormIdentifier' ) )
819 $this->mWasSubmitted =
false;
822 return $hoistedErrors;
825 $callback = $this->mSubmitCallback;
826 if ( !is_callable( $callback ) ) {
827 throw new LogicException(
'HTMLForm: no submit callback provided. Use ' .
828 'setSubmitCallback() to set one.' );
833 $res = $callback( $data, $this );
834 if ( $res ===
false ) {
835 $this->mWasSubmitted =
false;
836 } elseif ( $res instanceof StatusValue ) {
838 $res = Status::wrap( $res );
856 return $this->mWasSubmitted;
870 $this->mSubmitCallback = $cb;
885 $this->mValidationErrorMessage = $msg;
913 $this->mPre .= $html;
938 if ( $section ===
null ) {
939 $this->mHeader .= $html;
941 $this->mSectionHeaders[$section] ??=
'';
942 $this->mSectionHeaders[$section] .= $html;
958 if ( $section ===
null ) {
959 $this->mHeader = $html;
961 $this->mSectionHeaders[$section] = $html;
976 return $section ? $this->mSectionHeaders[$section] ??
'' : $this->mHeader;
989 if ( $section ===
null ) {
990 $this->mFooter .= $html;
992 $this->mSectionFooters[$section] ??=
'';
993 $this->mSectionFooters[$section] .= $html;
1009 if ( $section ===
null ) {
1010 $this->mFooter = $html;
1012 $this->mSectionFooters[$section] = $html;
1026 return $section ? $this->mSectionFooters[$section] ??
'' : $this->mFooter;
1038 $this->mPost .= $html;
1052 $this->mPost = $html;
1064 return $this->mPost;
1078 throw new \InvalidArgumentException(
1079 "Non-Codex HTMLForms do not support additional section information."
1083 $this->mSections = $sections;
1099 if ( !is_array( $value ) ) {
1101 $attribs += [
'name' => $name ];
1102 $this->mHiddenFields[] = [ $value, $attribs ];
1120 foreach ( $fields as $name => $value ) {
1121 if ( is_array( $value ) ) {
1125 $this->mHiddenFields[] = [ $value, [
'name' => $name ] ];
1155 if ( !is_array( $data ) ) {
1156 $args = func_get_args();
1157 if ( count( $args ) < 2 || count( $args ) > 4 ) {
1158 throw new InvalidArgumentException(
1159 'Incorrect number of arguments for deprecated calling style'
1164 'value' => $args[1],
1165 'id' => $args[2] ??
null,
1166 'attribs' => $args[3] ??
null,
1169 if ( !isset( $data[
'name'] ) ) {
1170 throw new InvalidArgumentException(
'A name is required' );
1172 if ( !isset( $data[
'value'] ) ) {
1173 throw new InvalidArgumentException(
'A value is required' );
1176 $this->mButtons[] = $data + [
1196 $this->mTokenSalt = $salt;
1222 private function getHiddenTitle(): string {
1223 if ( $this->hiddenTitleAddedToForm ) {
1228 if ( $this->getMethod() ===
'post' ||
1231 $html .=
Html::hidden(
'title', $this->getTitle()->getPrefixedText() ) .
"\n";
1233 $this->hiddenTitleAddedToForm =
true;
1248 # For good measure (it is the default)
1249 $this->
getOutput()->getMetadata()->setPreventClickjacking(
true );
1250 $this->
getOutput()->addModules(
'mediawiki.htmlform' );
1252 'mediawiki.htmlform.styles',
1254 'mediawiki.codex.messagebox.styles'
1257 if ( $this->mCollapsible ) {
1259 $this->
getOutput()->addModules(
'jquery.makeCollapsible' );
1267 . $this->getHiddenTitle()
1273 return $this->mPre . $this->
wrapForm( $html ) . $this->mPost;
1284 $this->mCollapsible =
true;
1285 $this->mCollapsed = $collapsedByDefault;
1295 # Use multipart/form-data
1296 $encType = $this->mUseMultipart
1297 ?
'multipart/form-data'
1298 :
'application/x-www-form-urlencoded';
1301 'class' =>
'mw-htmlform',
1304 'enctype' => $encType,
1307 $attribs[
'id'] = $this->mId;
1309 if ( is_string( $this->mAutocomplete ) ) {
1310 $attribs[
'autocomplete'] = $this->mAutocomplete;
1312 if ( $this->mName ) {
1313 $attribs[
'name'] = $this->mName;
1316 $attribs[
'novalidate'] =
true;
1329 # Include a <fieldset> wrapper for style, if requested.
1330 if ( $this->mWrapperLegend !==
false ) {
1331 $legend = is_string( $this->mWrapperLegend ) ? $this->mWrapperLegend :
false;
1332 $html = Html::rawElement(
1334 $this->mWrapperAttributes,
1335 ( $legend ?
Html::element(
'legend', [], $legend ) :
'' ) . $html
1339 return Html::rawElement(
1355 $html .= $this->getHiddenTitle();
1357 if ( $this->mFormIdentifier !==
null ) {
1358 $html .= Html::hidden(
1360 $this->mFormIdentifier
1364 $html .= Html::hidden(
1366 $this->
getUser()->getEditToken( $this->mTokenSalt ),
1367 [
'id' =>
'wpEditToken' ]
1371 foreach ( $this->mHiddenFields as [ $value, $attribs ] ) {
1372 $html .= Html::hidden( $attribs[
'name'], $value, $attribs ) .
"\n";
1386 if ( $this->mShowSubmit ) {
1389 if ( $this->mSubmitID !==
null ) {
1390 $attribs[
'id'] = $this->mSubmitID;
1393 if ( $this->mSubmitName !==
null ) {
1394 $attribs[
'name'] = $this->mSubmitName;
1397 if ( $this->mSubmitTooltip !==
null ) {
1398 $attribs += Linker::tooltipAndAccesskeyAttribs( $this->mSubmitTooltip );
1401 $attribs[
'class'] = [
'mw-htmlform-submit' ];
1403 $buttons .= Html::submitButton( $this->
getSubmitText(), $attribs ) .
"\n";
1406 if ( $this->mShowCancel ) {
1413 $this->
msg(
'cancel' )->text()
1417 foreach ( $this->mButtons as $button ) {
1420 'name' => $button[
'name'],
1421 'value' => $button[
'value']
1424 if ( isset( $button[
'label-message'] ) ) {
1425 $label = $this->
getMessage( $button[
'label-message'] )->parse();
1426 } elseif ( isset( $button[
'label'] ) ) {
1427 $label = htmlspecialchars( $button[
'label'] );
1428 } elseif ( isset( $button[
'label-raw'] ) ) {
1429 $label = $button[
'label-raw'];
1431 $label = htmlspecialchars( $button[
'value'] );
1435 if ( $button[
'attribs'] ) {
1436 $attrs += $button[
'attribs'];
1439 if ( isset( $button[
'id'] ) ) {
1440 $attrs[
'id'] = $button[
'id'];
1443 $buttons .= Html::rawElement(
'button', $attrs, $label ) .
"\n";
1450 return Html::rawElement(
'span',
1451 [
'class' =>
'mw-htmlform-submit-buttons' ],
"\n$buttons" ) .
"\n";
1460 return $this->
displaySection( $this->mFieldTree, $this->mTableId );
1473 if ( !in_array( $elementsType, [
'error',
'warning' ],
true ) ) {
1474 throw new DomainException( $elementsType .
' is not a valid type.' );
1476 $elementstr =
false;
1477 if ( $elements instanceof
Status ) {
1478 [ $errorStatus, $warningStatus ] = $elements->splitByErrorType();
1479 $status = $elementsType ===
'error' ? $errorStatus : $warningStatus;
1480 if ( $status->isGood() ) {
1483 $elementstr = $status
1485 ->setContext( $this )
1486 ->setInterfaceMessageFlag(
true )
1489 } elseif ( $elementsType ===
'error' ) {
1490 if ( is_array( $elements ) ) {
1492 } elseif ( $elements && $elements !==
true ) {
1493 $elementstr = (string)$elements;
1497 if ( !$elementstr ) {
1499 } elseif ( $elementsType ===
'error' ) {
1500 return Html::errorBox( $elementstr );
1502 return Html::warningBox( $elementstr );
1516 foreach ( $errors as $error ) {
1517 $errorstr .= Html::rawElement(
1524 return Html::rawElement(
'ul', [], $errorstr );
1536 $this->mSubmitText = $t;
1548 $this->mSubmitFlags = [
'destructive',
'primary' ];
1562 if ( !$msg instanceof
Message ) {
1563 $msg = $this->
msg( $msg );
1575 return $this->mSubmitText ?: $this->
msg(
'htmlform-submit' )->text();
1584 $this->mSubmitName = $name;
1595 $this->mSubmitTooltip = $name;
1609 $this->mSubmitID = $t;
1627 $this->mSubmitLockIcon =
true;
1628 $this->
getOutput()->addModuleStyles(
'oojs-ui.styles.icons-moderation' );
1652 $this->mFormIdentifier = $ident;
1653 $this->mSingleForm = $single;
1669 $this->mShowSubmit = !$suppressSubmit;
1681 $this->mShowCancel = $show;
1693 $target = TitleValue::castPageToLinkTarget( $target );
1696 $this->mCancelTarget = $target;
1705 if ( is_string( $this->mCancelTarget ) ) {
1706 return $this->mCancelTarget;
1709 $target = Title::castFromLinkTarget( $this->mCancelTarget ) ?: Title::newMainPage();
1710 return $target->getLocalURL();
1724 $this->mTableId = $id;
1745 $this->mName = $name;
1763 $this->mWrapperLegend = $legend;
1776 $this->mWrapperAttributes = $attributes;
1791 if ( !$msg instanceof
Message ) {
1792 $msg = $this->
msg( $msg );
1809 $this->mMessagePrefix = $p;
1823 $this->mTitle = Title::castFromPageReference( $t );
1832 return $this->mTitle ?: $this->
getContext()->getTitle();
1843 $this->mMethod = strtolower( $method );
1852 return $this->mMethod;
1866 return Html::rawElement(
1893 $fieldsetIDPrefix =
'',
1894 &$hasUserVisibleFields =
false
1896 if ( $this->mFieldData ===
null ) {
1897 throw new LogicException(
'HTMLForm::displaySection() called on uninitialized field data. '
1898 .
'You probably called displayForm() without calling prepareForm() first.' );
1902 $subsectionHtml =
'';
1905 foreach ( $fields as $key => $value ) {
1907 $v = array_key_exists( $key, $this->mFieldData )
1908 ? $this->mFieldData[$key]
1909 : $value->getDefault();
1915 if ( $value->hasVisibleOutput() ) {
1918 $labelValue = trim( $value->getLabel() );
1919 if ( $labelValue !==
"\u{00A0}" && $labelValue !==
' ' && $labelValue !==
'' ) {
1923 $hasUserVisibleFields =
true;
1925 } elseif ( is_array( $value ) ) {
1926 $subsectionHasVisibleFields =
false;
1930 "$fieldsetIDPrefix$key-",
1931 $subsectionHasVisibleFields );
1933 if ( $subsectionHasVisibleFields ===
true ) {
1935 $hasUserVisibleFields =
true;
1941 $section = $headerHtml .
1946 if ( $fieldsetIDPrefix ) {
1947 $attributes[
'id'] = Sanitizer::escapeIdForAttribute(
"$fieldsetIDPrefix$key" );
1950 $legend, $section, $attributes, $fields === $this->mFieldTree
1954 $subsectionHtml .= $section;
1959 $html = $this->
formatSection( $html, $sectionName, $hasLabel );
1961 if ( $subsectionHtml ) {
1962 if ( $this->mSubSectionBeforeFields ) {
1963 return $subsectionHtml .
"\n" . $html;
1965 return $html .
"\n" . $subsectionHtml;
1986 return $field->
getDiv( $value );
1988 return $field->
getRaw( $value );
1992 throw new LogicException(
'Not implemented' );
2004 protected function formatSection( array $fieldsHtml, $sectionName, $anyFieldHasLabel ) {
2005 if ( !$fieldsHtml ) {
2012 $html = implode(
'', $fieldsHtml );
2019 $attribs = $anyFieldHasLabel ? [] : [
'class' =>
'mw-htmlform-nolabel' ];
2021 if ( $sectionName ) {
2022 $attribs[
'id'] = Sanitizer::escapeIdForAttribute( $sectionName );
2026 return Html::rawElement(
'table',
2028 Html::rawElement(
'tbody', [],
"\n$html\n" ) ) .
"\n";
2030 return Html::rawElement(
'span', $attribs,
"\n$html\n" );
2032 return Html::rawElement(
'div', $attribs,
"\n$html\n" );
2050 foreach ( $this->mFlatFields as $fieldname => $field ) {
2051 if ( $field->skipLoadData(
$request ) ) {
2054 if ( $field->mParams[
'disabled'] ??
false ) {
2055 $fieldData[$fieldname] = $field->getDefault();
2057 $fieldData[$fieldname] = $field->loadDataFromRequest(
$request );
2063 foreach ( $fieldData as $name => &$value ) {
2064 $field = $this->mFlatFields[$name];
2065 if ( $field->isDisabled( $fieldData ) ) {
2066 $value = $field->getDefault();
2071 foreach ( $fieldData as $name => &$value ) {
2072 $field = $this->mFlatFields[$name];
2073 $value = $field->filter( $value, $fieldData );
2076 $this->mFieldData = $fieldData;
2103 return $this->
msg( $this->mMessagePrefix ?
"{$this->mMessagePrefix}-$key" : $key )->text();
2117 $this->mAction = $action;
2131 if ( $this->mAction !==
false ) {
2132 return $this->mAction;
2141 if ( str_contains( $articlePath,
'?' ) && $this->
getMethod() ===
'get' ) {
2145 return $this->
getTitle()->getLocalURL();
2159 $this->mAutocomplete = $autocomplete;
2184 foreach ( $this->mFlatFields as $field ) {
2185 if ( $field->needsJSForHtml5FormValidation() ) {
2194class_alias( HTMLForm::class,
'HTMLForm' );
if(!defined('MW_SETUP_CALLBACK'))
The simplest way of implementing IContextSource is to hold a RequestContext as a member variable and ...
getCsrfTokenSet()
Get a repository to obtain and match CSRF tokens.
setContext(IContextSource $context)
msg( $key,... $params)
Get a Message object with context set Parameters are the same as wfMessage().
getContext()
Get the base IContextSource object.
const ArticlePath
Name constant for the ArticlePath setting, for use with Config\get().
const Script
Name constant for the Script setting, for use with Config\get().
isGood()
Returns whether the operation completed and didn't have any error or warnings.
Interface for objects which can provide a MediaWiki context on request.