24use MediaWiki\HookContainer\ProtectedHookAccessorTrait;
159 use ProtectedHookAccessorTrait;
162 public static $typeMappings = [
163 'api' => HTMLApiField::class,
164 'text' => HTMLTextField::class,
165 'textwithbutton' => HTMLTextFieldWithButton::class,
166 'textarea' => HTMLTextAreaField::class,
167 'select' => HTMLSelectField::class,
168 'combobox' => HTMLComboboxField::class,
169 'radio' => HTMLRadioField::class,
170 'multiselect' => HTMLMultiSelectField::class,
171 'limitselect' => HTMLSelectLimitField::class,
172 'check' => HTMLCheckField::class,
173 'toggle' => HTMLCheckField::class,
174 'int' => HTMLIntField::class,
175 'file' => HTMLFileField::class,
176 'float' => HTMLFloatField::class,
177 'info' => HTMLInfoField::class,
178 'selectorother' => HTMLSelectOrOtherField::class,
179 'selectandother' => HTMLSelectAndOtherField::class,
180 'namespaceselect' => HTMLSelectNamespace::class,
181 'namespaceselectwithbutton' => HTMLSelectNamespaceWithButton::class,
182 'tagfilter' => HTMLTagFilter::class,
183 'sizefilter' => HTMLSizeFilterField::class,
184 'submit' => HTMLSubmitField::class,
185 'hidden' => HTMLHiddenField::class,
186 'edittools' => HTMLEditTools::class,
187 'checkmatrix' => HTMLCheckMatrix::class,
188 'cloner' => HTMLFormFieldCloner::class,
189 'autocompleteselect' => HTMLAutoCompleteSelectField::class,
190 'language' => HTMLSelectLanguageField::class,
191 'date' => HTMLDateTimeField::class,
192 'time' => HTMLDateTimeField::class,
193 'datetime' => HTMLDateTimeField::class,
194 'expiry' => HTMLExpiryField::class,
195 'timezone' => HTMLTimezoneField::class,
199 'email' => HTMLTextField::class,
200 'password' => HTMLTextField::class,
201 'url' => HTMLTextField::class,
202 'title' => HTMLTitleTextField::class,
203 'user' => HTMLUserTextField::class,
204 'tagmultiselect' => HTMLTagMultiselectField::class,
205 'usersmultiselect' => HTMLUsersMultiselectField::class,
206 'titlesmultiselect' => HTMLTitlesMultiselectField::class,
207 'namespacesmultiselect' => HTMLNamespacesMultiselectField::class,
215 protected $mFlatFields = [];
220 protected $mSubmitFlags = [
'primary',
'progressive' ];
266 protected $mCollapsible =
false;
273 protected $mCollapsed =
false;
287 protected $mHiddenFields = [];
292 protected $mButtons = [];
301 protected $mTokenSalt =
'';
311 protected $mSubSectionBeforeFields =
true;
318 protected $displayFormat =
'table';
324 protected $availableDisplayFormats = [
335 protected $availableSubclassDisplayFormats = [
345 private $hiddenTitleAddedToForm =
false;
361 $displayFormat, $descriptor,
IContextSource $context, $messagePrefix =
''
363 switch ( $displayFormat ) {
365 return new CodexHTMLForm( $descriptor, $context, $messagePrefix );
367 return new VFormHTMLForm( $descriptor, $context, $messagePrefix );
369 return new OOUIHTMLForm( $descriptor, $context, $messagePrefix );
371 $form =
new self( $descriptor, $context, $messagePrefix );
372 $form->setDisplayFormat( $displayFormat );
392 $this->mMessagePrefix = $messagePrefix;
396 !$this->
getConfig()->
get( MainConfigNames::HTMLFormAllowTableFormat )
397 && $this->displayFormat ===
'table'
399 $this->displayFormat =
'div';
415 $loadedDescriptor = [];
417 foreach ( $descriptor as $fieldname => $info ) {
418 $section = $info[
'section'] ??
'';
420 if ( isset( $info[
'type'] ) && $info[
'type'] ===
'file' ) {
421 $this->mUseMultipart =
true;
424 $field = static::loadInputFromParameters( $fieldname, $info, $this );
426 $setSection =& $loadedDescriptor;
428 foreach ( explode(
'/', $section ) as $newName ) {
429 $setSection[$newName] ??= [];
430 $setSection =& $setSection[$newName];
434 $setSection[$fieldname] = $field;
435 $this->mFlatFields[$fieldname] = $field;
438 $this->mFieldTree = array_merge_recursive( $this->mFieldTree, $loadedDescriptor );
448 return isset( $this->mFlatFields[$fieldname] );
457 if ( !$this->
hasField( $fieldname ) ) {
458 throw new DomainException( __METHOD__ .
': no field named ' . $fieldname );
460 return $this->mFlatFields[$fieldname];
475 in_array( $format, $this->availableSubclassDisplayFormats,
true ) ||
476 in_array( $this->displayFormat, $this->availableSubclassDisplayFormats,
true )
478 throw new MWException(
'Cannot change display format after creation, ' .
479 'use HTMLForm::factory() instead' );
482 if ( !in_array( $format, $this->availableDisplayFormats,
true ) ) {
483 throw new MWException(
'Display format must be one of ' .
486 $this->availableDisplayFormats,
487 $this->availableSubclassDisplayFormats
494 if ( !$this->
getConfig()->
get( MainConfigNames::HTMLFormAllowTableFormat ) &&
495 $format ===
'table' ) {
499 $this->displayFormat = $format;
510 return $this->displayFormat;
531 if ( isset( $descriptor[
'class'] ) ) {
532 $class = $descriptor[
'class'];
533 } elseif ( isset( $descriptor[
'type'] ) ) {
534 $class = static::$typeMappings[$descriptor[
'type']];
535 $descriptor[
'class'] = $class;
541 throw new MWException(
"Descriptor with no class for $fieldname: "
542 . print_r( $descriptor,
true ) );
564 $class = static::getClassFromDescriptor( $fieldname, $descriptor );
566 $descriptor[
'fieldname'] = $fieldname;
568 $descriptor[
'parent'] = $parent;
571 # @todo This will throw a fatal error whenever someone try to use
572 # 'class' to feed a CSS class instead of 'cssclass'. Would be
573 # great to avoid the fatal error and show a nice error.
574 return new $class( $descriptor );
587 # Load data from the request.
589 $this->mFormIdentifier ===
null ||
590 $this->
getRequest()->getVal(
'wpFormIdentifier' ) === $this->mFormIdentifier ||
591 $this->mSingleForm && $this->
getMethod() ===
'get'
595 $this->mFieldData = [];
608 if ( $this->mFormIdentifier ===
null ) {
611 $identOkay = $this->
getRequest()->getVal(
'wpFormIdentifier' ) === $this->mFormIdentifier;
617 } elseif ( $this->
getRequest()->wasPosted() ) {
618 $editToken = $this->
getRequest()->getVal(
'wpEditToken' );
619 if ( $this->
getUser()->isRegistered() || $editToken !==
null ) {
623 $tokenOkay = $this->
getUser()->matchEditToken( $editToken, $this->mTokenSalt );
629 if ( $tokenOkay && $identOkay ) {
630 $this->mWasSubmitted =
true;
648 if ( $result ===
true || ( $result instanceof
Status && $result->
isGood() ) ) {
686 $hoistedErrors = Status::newGood();
687 if ( $this->mValidationErrorMessage ) {
688 foreach ( $this->mValidationErrorMessage as $error ) {
689 $hoistedErrors->fatal( ...$error );
692 $hoistedErrors->fatal(
'htmlform-invalid-input' );
695 $this->mWasSubmitted =
true;
697 # Check for cancelled submission
698 foreach ( $this->mFlatFields as $fieldname => $field ) {
699 if ( !array_key_exists( $fieldname, $this->mFieldData ) ) {
702 if ( $field->cancelSubmit( $this->mFieldData[$fieldname], $this->mFieldData ) ) {
703 $this->mWasSubmitted =
false;
708 # Check for validation
709 $hasNonDefault =
false;
710 foreach ( $this->mFlatFields as $fieldname => $field ) {
711 if ( !array_key_exists( $fieldname, $this->mFieldData ) ) {
714 $hasNonDefault = $hasNonDefault || $this->mFieldData[$fieldname] !== $field->getDefault();
715 if ( $field->isDisabled( $this->mFieldData ) ) {
718 $res = $field->validate( $this->mFieldData[$fieldname], $this->mFieldData );
719 if ( $res !==
true ) {
721 if ( $res !==
false && !$field->canDisplayErrors() ) {
722 if ( is_string( $res ) ) {
723 $hoistedErrors->fatal(
'rawmessage', $res );
725 $hoistedErrors->fatal( $res );
733 if ( !$hasNonDefault && $this->
getMethod() ===
'get' &&
734 ( $this->mFormIdentifier ===
null ||
735 $this->
getRequest()->getCheck(
'wpFormIdentifier' ) )
737 $this->mWasSubmitted =
false;
740 return $hoistedErrors;
743 $callback = $this->mSubmitCallback;
744 if ( !is_callable( $callback ) ) {
745 throw new MWException(
'HTMLForm: no submit callback provided. Use ' .
746 'setSubmitCallback() to set one.' );
751 $res = call_user_func( $callback, $data, $this );
752 if ( $res ===
false ) {
753 $this->mWasSubmitted =
false;
756 $res = Status::wrap( $res );
774 return $this->mWasSubmitted;
788 $this->mSubmitCallback = $cb;
803 $this->mValidationErrorMessage = $msg;
843 $this->mPre .= $html;
903 if ( $section ===
null ) {
904 $this->mHeader .= $html;
906 $this->mSectionHeaders[$section] ??=
'';
907 $this->mSectionHeaders[$section] .= $html;
923 if ( $section ===
null ) {
924 $this->mHeader = $html;
926 $this->mSectionHeaders[$section] = $html;
941 return $section ? $this->mSectionHeaders[$section] ??
'' : $this->mHeader;
994 if ( $section ===
null ) {
995 $this->mFooter .= $html;
997 $this->mSectionFooters[$section] ??=
'';
998 $this->mSectionFooters[$section] .= $html;
1014 if ( $section ===
null ) {
1015 $this->mFooter = $html;
1017 $this->mSectionFooters[$section] = $html;
1031 return $section ? $this->mSectionFooters[$section] ??
'' : $this->mFooter;
1082 $this->mPost .= $html;
1096 $this->mPost = $html;
1108 return $this->mPost;
1146 if ( !is_array( $value ) ) {
1148 $attribs += [
'name' => $name ];
1149 $this->mHiddenFields[] = [ $value, $attribs ];
1167 foreach ( $fields as $name => $value ) {
1168 if ( is_array( $value ) ) {
1172 $this->mHiddenFields[] = [ $value, [
'name' => $name ] ];
1202 if ( !is_array( $data ) ) {
1203 $args = func_get_args();
1204 if ( count( $args ) < 2 || count( $args ) > 4 ) {
1205 throw new InvalidArgumentException(
1206 'Incorrect number of arguments for deprecated calling style'
1211 'value' => $args[1],
1212 'id' => $args[2] ??
null,
1213 'attribs' => $args[3] ??
null,
1216 if ( !isset( $data[
'name'] ) ) {
1217 throw new InvalidArgumentException(
'A name is required' );
1219 if ( !isset( $data[
'value'] ) ) {
1220 throw new InvalidArgumentException(
'A value is required' );
1223 $this->mButtons[] = $data + [
1243 $this->mTokenSalt = $salt;
1270 private function getHiddenTitle(): string {
1271 if ( $this->hiddenTitleAddedToForm ) {
1279 $html .= Html::hidden(
'title', $this->
getTitle()->getPrefixedText() ) .
"\n";
1281 $this->hiddenTitleAddedToForm =
true;
1296 # For good measure (it is the default)
1297 $this->getOutput()->setPreventClickjacking(
true );
1298 $this->getOutput()->addModules(
'mediawiki.htmlform' );
1299 $this->getOutput()->addModuleStyles(
'mediawiki.htmlform.styles' );
1301 if ( $this->mCollapsible ) {
1303 $this->getOutput()->addModules(
'jquery.makeCollapsible' );
1306 $html = $this->getErrorsOrWarnings( $submitResult,
'error' )
1307 . $this->getErrorsOrWarnings( $submitResult,
'warning' )
1308 . $this->getHeaderText()
1309 . $this->getHiddenTitle()
1311 . $this->getHiddenFields()
1312 . $this->getButtons()
1313 . $this->getFooterText();
1315 return $this->mPre . $this->wrapForm( $html ) . $this->mPost;
1326 $this->mCollapsible =
true;
1327 $this->mCollapsed = $collapsedByDefault;
1337 # Use multipart/form-data
1338 $encType = $this->mUseMultipart
1339 ?
'multipart/form-data'
1340 :
'application/x-www-form-urlencoded';
1343 'class' =>
'mw-htmlform',
1344 'action' => $this->getAction(),
1345 'method' => $this->getMethod(),
1346 'enctype' => $encType,
1349 $attribs[
'id'] = $this->mId;
1351 if ( is_string( $this->mAutocomplete ) ) {
1352 $attribs[
'autocomplete'] = $this->mAutocomplete;
1354 if ( $this->mName ) {
1355 $attribs[
'name'] = $this->mName;
1357 if ( $this->needsJSForHtml5FormValidation() ) {
1358 $attribs[
'novalidate'] =
true;
1371 # Include a <fieldset> wrapper for style, if requested.
1372 if ( $this->mWrapperLegend !==
false ) {
1373 $legend = is_string( $this->mWrapperLegend ) ? $this->mWrapperLegend :
false;
1374 $html = Xml::fieldset( $legend, $html, $this->mWrapperAttributes );
1377 return Html::rawElement(
1379 $this->getFormAttributes(),
1393 $html .= $this->getHiddenTitle();
1395 if ( $this->mFormIdentifier !==
null ) {
1396 $html .= Html::hidden(
1398 $this->mFormIdentifier
1401 if ( $this->getMethod() ===
'post' ) {
1402 $html .= Html::hidden(
1404 $this->
getUser()->getEditToken( $this->mTokenSalt ),
1405 [
'id' =>
'wpEditToken' ]
1409 foreach ( $this->mHiddenFields as [ $value, $attribs ] ) {
1410 $html .= Html::hidden( $attribs[
'name'], $value, $attribs ) .
"\n";
1423 $useMediaWikiUIEverywhere =
1424 $this->getConfig()->get( MainConfigNames::UseMediaWikiUIEverywhere );
1426 if ( $this->mShowSubmit ) {
1429 if ( isset( $this->mSubmitID ) ) {
1430 $attribs[
'id'] = $this->mSubmitID;
1433 if ( isset( $this->mSubmitName ) ) {
1434 $attribs[
'name'] = $this->mSubmitName;
1437 if ( isset( $this->mSubmitTooltip ) ) {
1438 $attribs += Linker::tooltipAndAccesskeyAttribs( $this->mSubmitTooltip );
1441 $attribs[
'class'] = [
'mw-htmlform-submit' ];
1443 if ( $useMediaWikiUIEverywhere ) {
1444 foreach ( $this->mSubmitFlags as $flag ) {
1445 $attribs[
'class'][] =
'mw-ui-' . $flag;
1447 $attribs[
'class'][] =
'mw-ui-button';
1450 $buttons .= Xml::submitButton( $this->getSubmitText(), $attribs ) .
"\n";
1453 if ( $this->mShowReset ) {
1454 $buttons .= Html::element(
1458 'value' => $this->msg(
'htmlform-reset' )->text(),
1459 'class' => $useMediaWikiUIEverywhere ?
'mw-ui-button' :
null,
1464 if ( $this->mShowCancel ) {
1465 $target = $this->getCancelTargetURL();
1466 $buttons .= Html::element(
1469 'class' => $useMediaWikiUIEverywhere ?
'mw-ui-button' :
null,
1472 $this->msg(
'cancel' )->text()
1476 foreach ( $this->mButtons as $button ) {
1479 'name' => $button[
'name'],
1480 'value' => $button[
'value']
1483 if ( isset( $button[
'label-message'] ) ) {
1484 $label = $this->getMessage( $button[
'label-message'] )->parse();
1485 } elseif ( isset( $button[
'label'] ) ) {
1486 $label = htmlspecialchars( $button[
'label'] );
1487 } elseif ( isset( $button[
'label-raw'] ) ) {
1488 $label = $button[
'label-raw'];
1490 $label = htmlspecialchars( $button[
'value'] );
1494 if ( $button[
'attribs'] ) {
1496 $attrs += $button[
'attribs'];
1499 if ( isset( $button[
'id'] ) ) {
1500 $attrs[
'id'] = $button[
'id'];
1503 if ( $useMediaWikiUIEverywhere ) {
1504 $attrs[
'class'] = (array)( $attrs[
'class'] ?? [] );
1505 $attrs[
'class'][] =
'mw-ui-button';
1508 $buttons .= Html::rawElement(
'button', $attrs, $label ) .
"\n";
1515 return Html::rawElement(
'span',
1516 [
'class' =>
'mw-htmlform-submit-buttons' ],
"\n$buttons" ) .
"\n";
1525 return $this->displaySection( $this->mFieldTree, $this->mTableId );
1538 if ( !in_array( $elementsType, [
'error',
'warning' ],
true ) ) {
1539 throw new DomainException( $elementsType .
' is not a valid type.' );
1541 $elementstr =
false;
1542 if ( $elements instanceof
Status ) {
1543 [ $errorStatus, $warningStatus ] = $elements->splitByErrorType();
1544 $status = $elementsType ===
'error' ? $errorStatus : $warningStatus;
1545 if ( $status->isGood() ) {
1548 $elementstr = $status
1550 ->setContext( $this )
1551 ->setInterfaceMessageFlag(
true )
1554 } elseif ( $elementsType ===
'error' ) {
1555 if ( is_array( $elements ) ) {
1556 $elementstr = $this->formatErrors( $elements );
1557 } elseif ( $elements && $elements !==
true ) {
1558 $elementstr = (string)$elements;
1562 if ( !$elementstr ) {
1564 } elseif ( $elementsType ===
'error' ) {
1565 return Html::errorBox( $elementstr );
1567 return Html::warningBox( $elementstr );
1581 foreach ( $errors as $error ) {
1582 $errorstr .= Html::rawElement(
1585 $this->getMessage( $error )->parse()
1589 return Html::rawElement(
'ul', [], $errorstr );
1600 $this->mSubmitText = $t;
1612 $this->mSubmitFlags = [
'destructive',
'primary' ];
1626 if ( !$msg instanceof
Message ) {
1627 $msg = $this->msg( $msg );
1629 $this->setSubmitText( $msg->text() );
1639 return $this->mSubmitText ?: $this->msg(
'htmlform-submit' )->text();
1648 $this->mSubmitName = $name;
1659 $this->mSubmitTooltip = $name;
1673 $this->mSubmitID = $t;
1697 $this->mFormIdentifier = $ident;
1698 $this->mSingleForm = $single;
1714 $this->mShowSubmit = !$suppressSubmit;
1726 $this->mShowCancel = $show;
1738 $target = TitleValue::castPageToLinkTarget( $target );
1741 $this->mCancelTarget = $target;
1750 if ( is_string( $this->mCancelTarget ) ) {
1751 return $this->mCancelTarget;
1754 $target = Title::castFromLinkTarget( $this->mCancelTarget ) ?: Title::newMainPage();
1755 return $target->getLocalURL();
1769 $this->mTableId = $id;
1790 $this->mName = $name;
1807 $this->mWrapperLegend = $legend;
1820 $this->mWrapperAttributes = $attributes;
1835 if ( !$msg instanceof
Message ) {
1836 $msg = $this->msg( $msg );
1838 $this->setWrapperLegend( $msg->text() );
1853 $this->mMessagePrefix = $p;
1867 $this->mTitle = Title::castFromPageReference( $t );
1876 return $this->mTitle ?: $this->
getContext()->getTitle();
1887 $this->mMethod = strtolower( $method );
1896 return $this->mMethod;
1910 return Xml::fieldset( $legend, $section, $attributes ) .
"\n";
1932 $fieldsetIDPrefix =
'',
1933 &$hasUserVisibleFields =
false
1935 if ( $this->mFieldData ===
null ) {
1936 throw new LogicException(
'HTMLForm::displaySection() called on uninitialized field data. '
1937 .
'You probably called displayForm() without calling prepareForm() first.' );
1941 $subsectionHtml =
'';
1944 foreach ( $fields as $key => $value ) {
1946 $v = array_key_exists( $key, $this->mFieldData )
1947 ? $this->mFieldData[$key]
1948 : $value->getDefault();
1950 $retval = $this->formatField( $value, $v ??
'' );
1954 if ( $value->hasVisibleOutput() ) {
1957 $labelValue = trim( $value->getLabel() );
1958 if ( $labelValue !==
"\u{00A0}" && $labelValue !==
' ' && $labelValue !==
'' ) {
1962 $hasUserVisibleFields =
true;
1964 } elseif ( is_array( $value ) ) {
1965 $subsectionHasVisibleFields =
false;
1967 $this->displaySection( $value,
1969 "$fieldsetIDPrefix$key-",
1970 $subsectionHasVisibleFields );
1972 if ( $subsectionHasVisibleFields ===
true ) {
1974 $hasUserVisibleFields =
true;
1976 $legend = $this->getLegend( $key );
1978 $section = $this->getHeaderText( $key ) .
1980 $this->getFooterText( $key );
1983 if ( $fieldsetIDPrefix ) {
1984 $attributes[
'id'] = Sanitizer::escapeIdForAttribute(
"$fieldsetIDPrefix$key" );
1986 $subsectionHtml .= $this->wrapFieldSetSection(
1987 $legend, $section, $attributes, $fields === $this->mFieldTree
1991 $subsectionHtml .= $section;
1996 $html = $this->formatSection( $html, $sectionName, $hasLabel );
1998 if ( $subsectionHtml ) {
1999 if ( $this->mSubSectionBeforeFields ) {
2000 return $subsectionHtml .
"\n" . $html;
2002 return $html .
"\n" . $subsectionHtml;
2018 $displayFormat = $this->getDisplayFormat();
2019 switch ( $displayFormat ) {
2023 return $field->
getDiv( $value );
2025 return $field->
getRaw( $value );
2029 throw new LogicException(
'Not implemented' );
2041 protected function formatSection( array $fieldsHtml, $sectionName, $anyFieldHasLabel ) {
2042 if ( !$fieldsHtml ) {
2048 $displayFormat = $this->getDisplayFormat();
2049 $html = implode(
'', $fieldsHtml );
2051 if ( $displayFormat ===
'raw' ) {
2056 $attribs = $anyFieldHasLabel ? [] : [
'class' =>
'mw-htmlform-nolabel' ];
2058 if ( $sectionName ) {
2059 $attribs[
'id'] = Sanitizer::escapeIdForAttribute( $sectionName );
2062 if ( $displayFormat ===
'table' ) {
2063 return Html::rawElement(
'table',
2065 Html::rawElement(
'tbody', [],
"\n$html\n" ) ) .
"\n";
2066 } elseif ( $displayFormat ===
'inline' ) {
2067 return Html::rawElement(
'span', $attribs,
"\n$html\n" );
2069 return Html::rawElement(
'div', $attribs,
"\n$html\n" );
2077 $this->prepareForm();
2087 foreach ( $this->mFlatFields as $fieldname => $field ) {
2088 if ( $field->skipLoadData( $request ) ) {
2091 if ( $field->mParams[
'disabled'] ??
false ) {
2092 $fieldData[$fieldname] = $field->getDefault();
2094 $fieldData[$fieldname] = $field->loadDataFromRequest( $request );
2100 foreach ( $fieldData as $name => &$value ) {
2101 $field = $this->mFlatFields[$name];
2102 if ( $field->isDisabled( $fieldData ) ) {
2103 $value = $field->getDefault();
2108 foreach ( $fieldData as $name => &$value ) {
2109 $field = $this->mFlatFields[$name];
2110 $value = $field->filter( $value, $fieldData );
2113 $this->mFieldData = $fieldData;
2124 $this->mShowReset = !$suppressReset;
2153 return $this->msg( $this->mMessagePrefix ?
"{$this->mMessagePrefix}-$key" : $key )->text();
2167 $this->mAction = $action;
2181 if ( $this->mAction !==
false ) {
2182 return $this->mAction;
2185 $articlePath = $this->getConfig()->get( MainConfigNames::ArticlePath );
2191 if ( str_contains( $articlePath,
'?' ) && $this->getMethod() ===
'get' ) {
2192 return $this->getConfig()->get( MainConfigNames::Script );
2195 return $this->
getTitle()->getLocalURL();
2209 $this->mAutocomplete = $autocomplete;
2234 foreach ( $this->mFlatFields as $field ) {
2235 if ( $field->needsJSForHtml5FormValidation() ) {
if(!defined('MW_SETUP_CALLBACK'))
The simplest way of implementing IContextSource is to hold a RequestContext as a member variable and ...
setContext(IContextSource $context)
A class containing constants representing the names of configuration variables.
The Message class deals with fetching and processing of interface message into a variety of formats.
static newFromSpecifier( $value)
Transform a MessageSpecifier or a primitive value used interchangeably with specifiers (a message key...
Generic operation result class Has warning/error list, boolean status and arbitrary value.
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.