24use Wikimedia\ObjectFactory;
133 'api' => HTMLApiField::class,
134 'text' => HTMLTextField::class,
135 'textwithbutton' => HTMLTextFieldWithButton::class,
136 'textarea' => HTMLTextAreaField::class,
137 'select' => HTMLSelectField::class,
138 'combobox' => HTMLComboboxField::class,
139 'radio' => HTMLRadioField::class,
140 'multiselect' => HTMLMultiSelectField::class,
141 'limitselect' => HTMLSelectLimitField::class,
142 'check' => HTMLCheckField::class,
143 'toggle' => HTMLCheckField::class,
144 'int' => HTMLIntField::class,
145 'float' => HTMLFloatField::class,
146 'info' => HTMLInfoField::class,
147 'selectorother' => HTMLSelectOrOtherField::class,
148 'selectandother' => HTMLSelectAndOtherField::class,
149 'namespaceselect' => HTMLSelectNamespace::class,
150 'namespaceselectwithbutton' => HTMLSelectNamespaceWithButton::class,
151 'tagfilter' => HTMLTagFilter::class,
152 'sizefilter' => HTMLSizeFilterField::class,
153 'submit' => HTMLSubmitField::class,
154 'hidden' => HTMLHiddenField::class,
155 'edittools' => HTMLEditTools::class,
156 'checkmatrix' => HTMLCheckMatrix::class,
157 'cloner' => HTMLFormFieldCloner::class,
158 'autocompleteselect' => HTMLAutoCompleteSelectField::class,
159 'date' => HTMLDateTimeField::class,
160 'time' => HTMLDateTimeField::class,
161 'datetime' => HTMLDateTimeField::class,
165 'email' => HTMLTextField::class,
166 'password' => HTMLTextField::class,
167 'url' => HTMLTextField::class,
168 'title' => HTMLTitleTextField::class,
169 'user' => HTMLUserTextField::class,
170 'usersmultiselect' => HTMLUsersMultiselectField::class,
279 public static function factory( $displayFormat ) {
280 $arguments = func_get_args();
281 array_shift( $arguments );
285 return ObjectFactory::constructClassInstance( VFormHTMLForm::class, $arguments );
287 return ObjectFactory::constructClassInstance( OOUIHTMLForm::class, $arguments );
290 $form = ObjectFactory::constructClassInstance( self::class, $arguments );
309 $this->mTitle =
false;
310 $this->mMessagePrefix = $messagePrefix;
311 } elseif (
$context ===
null && $messagePrefix !==
'' ) {
312 $this->mMessagePrefix = $messagePrefix;
313 } elseif ( is_string(
$context ) && $messagePrefix ===
'' ) {
321 !$this->
getConfig()->
get(
'HTMLFormAllowTableFormat' )
322 && $this->displayFormat ===
'table'
324 $this->displayFormat =
'div';
328 $loadedDescriptor = [];
329 $this->mFlatFields = [];
331 foreach ( $descriptor as $fieldname => $info ) {
332 $section = isset( $info[
'section'] )
336 if ( isset( $info[
'type'] ) && $info[
'type'] ===
'file' ) {
337 $this->mUseMultipart =
true;
340 $field = static::loadInputFromParameters( $fieldname, $info, $this );
342 $setSection =& $loadedDescriptor;
344 $sectionParts = explode(
'/',
$section );
346 while ( count( $sectionParts ) ) {
347 $newName = array_shift( $sectionParts );
349 if ( !isset( $setSection[$newName] ) ) {
350 $setSection[$newName] = [];
353 $setSection =& $setSection[$newName];
357 $setSection[$fieldname] = $field;
358 $this->mFlatFields[$fieldname] = $field;
361 $this->mFieldTree = $loadedDescriptor;
369 return isset( $this->mFlatFields[$fieldname] );
378 if ( !$this->
hasField( $fieldname ) ) {
379 throw new DomainException( __METHOD__ .
': no field named ' . $fieldname );
381 return $this->mFlatFields[$fieldname];
396 in_array( $format, $this->availableSubclassDisplayFormats,
true ) ||
397 in_array( $this->displayFormat, $this->availableSubclassDisplayFormats,
true )
399 throw new MWException(
'Cannot change display format after creation, ' .
400 'use HTMLForm::factory() instead' );
403 if ( !in_array( $format, $this->availableDisplayFormats,
true ) ) {
404 throw new MWException(
'Display format must be one of ' .
407 $this->availableDisplayFormats,
408 $this->availableSubclassDisplayFormats
415 if ( !$this->
getConfig()->
get(
'HTMLFormAllowTableFormat' ) && $format ===
'table' ) {
419 $this->displayFormat = $format;
430 return $this->displayFormat;
450 if ( isset( $descriptor[
'class'] ) ) {
451 $class = $descriptor[
'class'];
452 } elseif ( isset( $descriptor[
'type'] ) ) {
453 $class = static::$typeMappings[$descriptor[
'type']];
454 $descriptor[
'class'] = $class;
460 throw new MWException(
"Descriptor with no class for $fieldname: "
461 . print_r( $descriptor,
true ) );
480 $class = static::getClassFromDescriptor( $fieldname, $descriptor );
482 $descriptor[
'fieldname'] = $fieldname;
484 $descriptor[
'parent'] = $parent;
487 # @todo This will throw a fatal error whenever someone try to use
488 # 'class' to feed a CSS class instead of 'cssclass'. Would be
489 # great to avoid the fatal error and show a nice error.
490 return new $class( $descriptor );
503 # Check if we have the info we need
504 if ( !$this->mTitle instanceof
Title && $this->mTitle !==
false ) {
505 throw new MWException(
'You must call setTitle() on an HTMLForm' );
508 # Load data from the request.
510 $this->mFormIdentifier ===
null ||
511 $this->
getRequest()->getVal(
'wpFormIdentifier' ) === $this->mFormIdentifier
515 $this->mFieldData = [];
529 if ( $this->mFormIdentifier ===
null ) {
532 $identOkay = $this->
getRequest()->getVal(
'wpFormIdentifier' ) === $this->mFormIdentifier;
538 } elseif ( $this->
getRequest()->wasPosted() ) {
539 $editToken = $this->
getRequest()->getVal(
'wpEditToken' );
540 if ( $this->
getUser()->isLoggedIn() || $editToken !==
null ) {
544 $tokenOkay = $this->
getUser()->matchEditToken( $editToken, $this->mTokenSalt );
550 if ( $tokenOkay && $identOkay ) {
551 $this->mWasSubmitted =
true;
568 if ( $result ===
true || ( $result instanceof
Status && $result->
isGood() ) ) {
605 $hoistedErrors = Status::newGood();
606 if ( $this->mValidationErrorMessage ) {
607 foreach ( (array)$this->mValidationErrorMessage as $error ) {
608 call_user_func_array( [ $hoistedErrors,
'fatal' ], $error );
611 $hoistedErrors->fatal(
'htmlform-invalid-input' );
614 $this->mWasSubmitted =
true;
616 # Check for cancelled submission
617 foreach ( $this->mFlatFields as $fieldname => $field ) {
618 if ( !array_key_exists( $fieldname, $this->mFieldData ) ) {
621 if ( $field->cancelSubmit( $this->mFieldData[$fieldname], $this->mFieldData ) ) {
622 $this->mWasSubmitted =
false;
627 # Check for validation
628 foreach ( $this->mFlatFields as $fieldname => $field ) {
629 if ( !array_key_exists( $fieldname, $this->mFieldData ) ) {
632 if ( $field->isHidden( $this->mFieldData ) ) {
635 $res = $field->validate( $this->mFieldData[$fieldname], $this->mFieldData );
636 if (
$res !==
true ) {
638 if (
$res !==
false && !$field->canDisplayErrors() ) {
639 if ( is_string(
$res ) ) {
640 $hoistedErrors->fatal(
'rawmessage',
$res );
642 $hoistedErrors->fatal(
$res );
649 return $hoistedErrors;
652 $callback = $this->mSubmitCallback;
653 if ( !is_callable( $callback ) ) {
654 throw new MWException(
'HTMLForm: no submit callback provided. Use ' .
655 'setSubmitCallback() to set one.' );
660 $res = call_user_func( $callback, $data, $this );
661 if (
$res ===
false ) {
662 $this->mWasSubmitted =
false;
680 return $this->mWasSubmitted;
694 $this->mSubmitCallback = $cb;
708 $this->mValidationErrorMessage = $msg;
763 $this->mHeader .= $msg;
765 if ( !isset( $this->mSectionHeaders[
$section] ) ) {
766 $this->mSectionHeaders[
$section] =
'';
768 $this->mSectionHeaders[
$section] .= $msg;
785 $this->mHeader = $msg;
787 $this->mSectionHeaders[
$section] = $msg;
802 return $this->mHeader;
804 return isset( $this->mSectionHeaders[
$section] ) ? $this->mSectionHeaders[
$section] :
'';
818 $this->mFooter .= $msg;
820 if ( !isset( $this->mSectionFooters[
$section] ) ) {
821 $this->mSectionFooters[
$section] =
'';
823 $this->mSectionFooters[
$section] .= $msg;
840 $this->mFooter = $msg;
842 $this->mSectionFooters[
$section] = $msg;
857 return $this->mFooter;
859 return isset( $this->mSectionFooters[
$section] ) ? $this->mSectionFooters[
$section] :
'';
871 $this->mPost .= $msg;
916 foreach ( $fields as $name =>
$value ) {
917 $this->mHiddenFields[] = [
$value, [
'name' =>
$name ] ];
948 if ( !is_array( $data ) ) {
949 $args = func_get_args();
950 if ( count(
$args ) < 2 || count(
$args ) > 4 ) {
951 throw new InvalidArgumentException(
952 'Incorrect number of arguments for deprecated calling style'
959 'attribs' => isset(
$args[3] ) ?
$args[3] :
null,
962 if ( !isset( $data[
'name'] ) ) {
963 throw new InvalidArgumentException(
'A name is required' );
965 if ( !isset( $data[
'value'] ) ) {
966 throw new InvalidArgumentException(
'A value is required' );
969 $this->mButtons[] = $data + [
989 $this->mTokenSalt = $salt;
1018 # For good measure (it is the default)
1019 $this->
getOutput()->preventClickjacking();
1020 $this->
getOutput()->addModules(
'mediawiki.htmlform' );
1021 $this->
getOutput()->addModuleStyles(
'mediawiki.htmlform.styles' );
1034 return '' . $this->mPre .
$html . $this->mPost;
1042 # Use multipart/form-data
1043 $encType = $this->mUseMultipart
1044 ?
'multipart/form-data'
1045 :
'application/x-www-form-urlencoded';
1048 'class' =>
'mw-htmlform',
1051 'enctype' => $encType,
1056 if ( is_string( $this->mAutocomplete ) ) {
1057 $attribs[
'autocomplete'] = $this->mAutocomplete;
1059 if ( $this->mName ) {
1076 # Include a <fieldset> wrapper for style, if requested.
1077 if ( $this->mWrapperLegend !==
false ) {
1078 $legend = is_string( $this->mWrapperLegend ) ? $this->mWrapperLegend :
false;
1082 return Html::rawElement(
1095 if ( $this->mFormIdentifier !==
null ) {
1096 $html .= Html::hidden(
1098 $this->mFormIdentifier
1102 $html .= Html::hidden(
1104 $this->
getUser()->getEditToken( $this->mTokenSalt ),
1105 [
'id' =>
'wpEditToken' ]
1107 $html .= Html::hidden(
'title', $this->
getTitle()->getPrefixedText() ) .
"\n";
1110 $articlePath = $this->
getConfig()->get(
'ArticlePath' );
1111 if ( strpos( $articlePath,
'?' ) !==
false && $this->
getMethod() ===
'get' ) {
1112 $html .= Html::hidden(
'title', $this->
getTitle()->getPrefixedText() ) .
"\n";
1115 foreach ( $this->mHiddenFields as $data ) {
1129 $useMediaWikiUIEverywhere = $this->
getConfig()->get(
'UseMediaWikiUIEverywhere' );
1131 if ( $this->mShowSubmit ) {
1134 if ( isset( $this->mSubmitID ) ) {
1138 if ( isset( $this->mSubmitName ) ) {
1139 $attribs[
'name'] = $this->mSubmitName;
1142 if ( isset( $this->mSubmitTooltip ) ) {
1146 $attribs[
'class'] = [
'mw-htmlform-submit' ];
1148 if ( $useMediaWikiUIEverywhere ) {
1149 foreach ( $this->mSubmitFlags as $flag ) {
1150 $attribs[
'class'][] =
'mw-ui-' . $flag;
1152 $attribs[
'class'][] =
'mw-ui-button';
1158 if ( $this->mShowReset ) {
1159 $buttons .= Html::element(
1163 'value' => $this->
msg(
'htmlform-reset' )->
text(),
1164 'class' => $useMediaWikiUIEverywhere ?
'mw-ui-button' :
null,
1169 if ( $this->mShowCancel ) {
1170 $target = $this->mCancelTarget ?: Title::newMainPage();
1171 if ( $target instanceof
Title ) {
1172 $target = $target->getLocalURL();
1174 $buttons .= Html::element(
1177 'class' => $useMediaWikiUIEverywhere ?
'mw-ui-button' :
null,
1180 $this->
msg(
'cancel' )->text()
1185 $isBadIE = preg_match(
'/MSIE [1-7]\./i', $this->
getRequest()->getHeader(
'User-Agent' ) );
1187 foreach ( $this->mButtons as $button ) {
1190 'name' => $button[
'name'],
1191 'value' => $button[
'value']
1194 if ( isset( $button[
'label-message'] ) ) {
1195 $label = $this->
getMessage( $button[
'label-message'] )->parse();
1196 } elseif ( isset( $button[
'label'] ) ) {
1197 $label = htmlspecialchars( $button[
'label'] );
1198 } elseif ( isset( $button[
'label-raw'] ) ) {
1199 $label = $button[
'label-raw'];
1201 $label = htmlspecialchars( $button[
'value'] );
1204 if ( $button[
'attribs'] ) {
1205 $attrs += $button[
'attribs'];
1208 if ( isset( $button[
'id'] ) ) {
1209 $attrs[
'id'] = $button[
'id'];
1212 if ( $useMediaWikiUIEverywhere ) {
1213 $attrs[
'class'] = isset( $attrs[
'class'] ) ? (
array)$attrs[
'class'] : [];
1214 $attrs[
'class'][] =
'mw-ui-button';
1218 $buttons .= Html::element(
'input', $attrs ) .
"\n";
1220 $buttons .= Html::rawElement(
'button', $attrs, $label ) .
"\n";
1228 return Html::rawElement(
'span',
1229 [
'class' =>
'mw-htmlform-submit-buttons' ],
"\n$buttons" ) .
"\n";
1237 return $this->
displaySection( $this->mFieldTree, $this->mTableId );
1263 if ( !in_array( $elementsType, [
'error',
'warning' ],
true ) ) {
1264 throw new DomainException( $elementsType .
' is not a valid type.' );
1266 $elementstr =
false;
1267 if ( $elements instanceof
Status ) {
1268 list( $errorStatus, $warningStatus ) = $elements->splitByErrorType();
1269 $status = $elementsType ===
'error' ? $errorStatus : $warningStatus;
1273 $elementstr = $this->
getOutput()->parse(
1277 } elseif ( is_array( $elements ) && $elementsType ===
'error' ) {
1279 } elseif ( $elementsType ===
'error' ) {
1280 $elementstr = $elements;
1284 ? Html::rawElement(
'div', [
'class' => $elementsType ], $elementstr )
1298 foreach ( $errors as $error ) {
1299 $errorstr .= Html::rawElement(
1306 $errorstr = Html::rawElement(
'ul', [], $errorstr );
1319 $this->mSubmitText =
$t;
1331 $this->mSubmitFlags = [
'destructive',
'primary' ];
1343 $this->mSubmitFlags = [
'progressive',
'primary' ];
1357 if ( !$msg instanceof
Message ) {
1358 $msg = $this->
msg( $msg );
1370 return $this->mSubmitText ?: $this->
msg(
'htmlform-submit' )->text();
1379 $this->mSubmitName =
$name;
1390 $this->mSubmitTooltip =
$name;
1404 $this->mSubmitID =
$t;
1425 $this->mFormIdentifier = $ident;
1441 $this->mShowSubmit = !$suppressSubmit;
1453 $this->mShowCancel = $show;
1464 $this->mCancelTarget = $target;
1478 $this->mTableId = $id;
1499 $this->mName =
$name;
1516 $this->mWrapperLegend = $legend;
1531 if ( !$msg instanceof
Message ) {
1532 $msg = $this->
msg( $msg );
1549 $this->mMessagePrefix = $p;
1572 return $this->mTitle ===
false
1585 $this->mMethod = strtolower( $method );
1594 return $this->mMethod;
1606 return Xml::fieldset( $legend,
$section, $attributes ) .
"\n";
1627 $fieldsetIDPrefix =
'',
1628 &$hasUserVisibleFields =
false
1630 if ( $this->mFieldData ===
null ) {
1631 throw new LogicException(
'HTMLForm::displaySection() called on uninitialized field data. '
1632 .
'You probably called displayForm() without calling prepareForm() first.' );
1638 $subsectionHtml =
'';
1645 foreach ( $fields as $key =>
$value ) {
1647 $v = array_key_exists( $key, $this->mFieldData )
1648 ? $this->mFieldData[$key]
1655 if (
$value->hasVisibleOutput() ) {
1658 $labelValue = trim(
$value->getLabel() );
1659 if ( $labelValue !==
' ' && $labelValue !==
'' ) {
1663 $hasUserVisibleFields =
true;
1665 } elseif ( is_array(
$value ) ) {
1666 $subsectionHasVisibleFields =
false;
1670 "$fieldsetIDPrefix$key-",
1671 $subsectionHasVisibleFields );
1674 if ( $subsectionHasVisibleFields ===
true ) {
1676 $hasUserVisibleFields =
true;
1685 if ( $fieldsetIDPrefix ) {
1686 $attributes[
'id'] = Sanitizer::escapeIdForAttribute(
"$fieldsetIDPrefix$key" );
1698 if ( $subsectionHtml ) {
1699 if ( $this->mSubSectionBeforeFields ) {
1700 return $subsectionHtml .
"\n" .
$html;
1702 return $html .
"\n" . $subsectionHtml;
1716 protected function formatSection( array $fieldsHtml, $sectionName, $anyFieldHasLabel ) {
1717 if ( !$fieldsHtml ) {
1724 $html = implode(
'', $fieldsHtml );
1732 if ( !$anyFieldHasLabel ) {
1733 $classes[] =
'mw-htmlform-nolabel';
1737 'class' => implode(
' ', $classes ),
1740 if ( $sectionName ) {
1741 $attribs[
'id'] = Sanitizer::escapeIdForAttribute( $sectionName );
1745 return Html::rawElement(
'table',
1747 Html::rawElement(
'tbody', [],
"\n$html\n" ) ) .
"\n";
1749 return Html::rawElement(
'span',
$attribs,
"\n$html\n" );
1751 return Html::rawElement(
'div',
$attribs,
"\n$html\n" );
1761 foreach ( $this->mFlatFields as $fieldname => $field ) {
1763 if ( $field->skipLoadData(
$request ) ) {
1765 } elseif ( !empty( $field->mParams[
'disabled'] ) ) {
1766 $fieldData[$fieldname] = $field->getDefault();
1768 $fieldData[$fieldname] = $field->loadDataFromRequest(
$request );
1773 foreach ( $fieldData as $name => &
$value ) {
1774 $field = $this->mFlatFields[
$name];
1778 $this->mFieldData = $fieldData;
1789 $this->mShowReset = !$suppressReset;
1816 return $this->
msg(
"{$this->mMessagePrefix}-$key" )->text();
1830 $this->mAction = $action;
1844 if ( $this->mAction !==
false ) {
1845 return $this->mAction;
1848 $articlePath = $this->
getConfig()->get(
'ArticlePath' );
1854 if ( strpos( $articlePath,
'?' ) !==
false && $this->
getMethod() ===
'get' ) {
1858 return $this->
getTitle()->getLocalURL();
1872 $this->mAutocomplete = $autocomplete;
1884 return Message::newFromSpecifier(
$value )->setContext( $this );
1897 foreach ( $this->mFlatFields as $fieldname => $field ) {
1898 if ( $field->needsJSForHtml5FormValidation() ) {
wfScript( $script='index')
Get the path to a specified script file, respecting file extensions; this is a wrapper around $wgScri...
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Throws a warning that $function is deprecated.
The simplest way of implementing IContextSource is to hold a RequestContext as a member variable and ...
msg( $key)
Get a Message object with context set Parameters are the same as wfMessage()
setContext(IContextSource $context)
static tooltipAndAccesskeyAttribs( $name, array $msgParams=[], $options=null)
Returns the attributes for the tooltip and access key.
The Message class provides methods which fulfil two basic services:
isGood()
Returns whether the operation completed and didn't have any error or warnings.
Generic operation result class Has warning/error list, boolean status and arbitrary value.
Represents a title within MediaWiki.
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add text
the array() calling protocol came about after MediaWiki 1.4rc1.
namespace being checked & $result
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults also a ContextSource after deleting those rows but within the same transaction you ll probably need to make sure the header is varied on $request
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a local account incomplete not yet checked for validity & $retval
Status::newGood()` to allow deletion, and then `return false` from the hook function. Ensure you consume the 'ChangeTagAfterDelete' hook to carry out custom deletion actions. $tag:name of the tag $user:user initiating the action & $status:Status object. See above. 'ChangeTagsListActive':Allows you to nominate which of the tags your extension uses are in active use. & $tags:list of all active tags. Append to this array. 'ChangeTagsAfterUpdateTags':Called after tags have been updated with the ChangeTags::updateTags function. Params:$addedTags:tags effectively added in the update $removedTags:tags effectively removed in the update $prevTags:tags that were present prior to the update $rc_id:recentchanges table id $rev_id:revision table id $log_id:logging table id $params:tag params $rc:RecentChange being tagged when the tagging accompanies the action or null $user:User who performed the tagging when the tagging is subsequent to the action or null 'ChangeTagsAllowedAdd':Called when checking if a user can add tags to a change. & $allowedTags:List of all the tags the user is allowed to add. Any tags the user wants to add( $addTags) that are not in this array will cause it to fail. You may add or remove tags to this array as required. $addTags:List of tags user intends to add. $user:User who is adding the tags. 'ChangeUserGroups':Called before user groups are changed. $performer:The User who will perform the change $user:The User whose groups will be changed & $add:The groups that will be added & $remove:The groups that will be removed 'Collation::factory':Called if $wgCategoryCollation is an unknown collation. $collationName:Name of the collation in question & $collationObject:Null. Replace with a subclass of the Collation class that implements the collation given in $collationName. 'ConfirmEmailComplete':Called after a user 's email has been confirmed successfully. $user:user(object) whose email is being confirmed 'ContentAlterParserOutput':Modify parser output for a given content object. Called by Content::getParserOutput after parsing has finished. Can be used for changes that depend on the result of the parsing but have to be done before LinksUpdate is called(such as adding tracking categories based on the rendered HTML). $content:The Content to render $title:Title of the page, as context $parserOutput:ParserOutput to manipulate 'ContentGetParserOutput':Customize parser output for a given content object, called by AbstractContent::getParserOutput. May be used to override the normal model-specific rendering of page content. $content:The Content to render $title:Title of the page, as context $revId:The revision ID, as context $options:ParserOptions for rendering. To avoid confusing the parser cache, the output can only depend on parameters provided to this hook function, not on global state. $generateHtml:boolean, indicating whether full HTML should be generated. If false, generation of HTML may be skipped, but other information should still be present in the ParserOutput object. & $output:ParserOutput, to manipulate or replace 'ContentHandlerDefaultModelFor':Called when the default content model is determined for a given title. May be used to assign a different model for that title. $title:the Title in question & $model:the model name. Use with CONTENT_MODEL_XXX constants. 'ContentHandlerForModelID':Called when a ContentHandler is requested for a given content model name, but no entry for that model exists in $wgContentHandlers. Note:if your extension implements additional models via this hook, please use GetContentModels hook to make them known to core. $modeName:the requested content model name & $handler:set this to a ContentHandler object, if desired. 'ContentModelCanBeUsedOn':Called to determine whether that content model can be used on a given page. This is especially useful to prevent some content models to be used in some special location. $contentModel:ID of the content model in question $title:the Title in question. & $ok:Output parameter, whether it is OK to use $contentModel on $title. Handler functions that modify $ok should generally return false to prevent further hooks from further modifying $ok. 'ContribsPager::getQueryInfo':Before the contributions query is about to run & $pager:Pager object for contributions & $queryInfo:The query for the contribs Pager 'ContribsPager::reallyDoQuery':Called before really executing the query for My Contributions & $data:an array of results of all contribs queries $pager:The ContribsPager object hooked into $offset:Index offset, inclusive $limit:Exact query limit $descending:Query direction, false for ascending, true for descending 'ContributionsLineEnding':Called before a contributions HTML line is finished $page:SpecialPage object for contributions & $ret:the HTML line $row:the DB row for this line & $classes:the classes to add to the surrounding< li > & $attribs:associative array of other HTML attributes for the< li > element. Currently only data attributes reserved to MediaWiki are allowed(see Sanitizer::isReservedDataAttribute). 'ContributionsToolLinks':Change tool links above Special:Contributions $id:User identifier $title:User page title & $tools:Array of tool links $specialPage:SpecialPage instance for context and services. Can be either SpecialContributions or DeletedContributionsPage. Extensions should type hint against a generic SpecialPage though. 'ConvertContent':Called by AbstractContent::convert when a conversion to another content model is requested. Handler functions that modify $result should generally return false to disable further attempts at conversion. $content:The Content object to be converted. $toModel:The ID of the content model to convert to. $lossy: boolean indicating whether lossy conversion is allowed. & $result:Output parameter, in case the handler function wants to provide a converted Content object. Note that $result->getContentModel() must return $toModel. 'CustomEditor':When invoking the page editor Return true to allow the normal editor to be used, or false if implementing a custom editor, e.g. for a special namespace, etc. $article:Article being edited $user:User performing the edit 'DatabaseOraclePostInit':Called after initialising an Oracle database $db:the DatabaseOracle object 'DeletedContribsPager::reallyDoQuery':Called before really executing the query for Special:DeletedContributions Similar to ContribsPager::reallyDoQuery & $data:an array of results of all contribs queries $pager:The DeletedContribsPager object hooked into $offset:Index offset, inclusive $limit:Exact query limit $descending:Query direction, false for ascending, true for descending 'DeletedContributionsLineEnding':Called before a DeletedContributions HTML line is finished. Similar to ContributionsLineEnding $page:SpecialPage object for DeletedContributions & $ret:the HTML line $row:the DB row for this line & $classes:the classes to add to the surrounding< li > & $attribs:associative array of other HTML attributes for the< li > element. Currently only data attributes reserved to MediaWiki are allowed(see Sanitizer::isReservedDataAttribute). 'DeleteUnknownPreferences':Called by the cleanupPreferences.php maintenance script to build a WHERE clause with which to delete preferences that are not known about. This hook is used by extensions that have dynamically-named preferences that should not be deleted in the usual cleanup process. For example, the Gadgets extension creates preferences prefixed with 'gadget-', and so anything with that prefix is excluded from the deletion. &where:An array that will be passed as the $cond parameter to IDatabase::select() to determine what will be deleted from the user_properties table. $db:The IDatabase object, useful for accessing $db->buildLike() etc. 'DifferenceEngineAfterLoadNewText':called in DifferenceEngine::loadNewText() after the new revision 's content has been loaded into the class member variable $differenceEngine->mNewContent but before returning true from this function. $differenceEngine:DifferenceEngine object 'DifferenceEngineLoadTextAfterNewContentIsLoaded':called in DifferenceEngine::loadText() after the new revision 's content has been loaded into the class member variable $differenceEngine->mNewContent but before checking if the variable 's value is null. This hook can be used to inject content into said class member variable. $differenceEngine:DifferenceEngine object 'DifferenceEngineMarkPatrolledLink':Allows extensions to change the "mark as patrolled" link which is shown both on the diff header as well as on the bottom of a page, usually wrapped in a span element which has class="patrollink". $differenceEngine:DifferenceEngine object & $markAsPatrolledLink:The "mark as patrolled" link HTML(string) $rcid:Recent change ID(rc_id) for this change(int) 'DifferenceEngineMarkPatrolledRCID':Allows extensions to possibly change the rcid parameter. For example the rcid might be set to zero due to the user being the same as the performer of the change but an extension might still want to show it under certain conditions. & $rcid:rc_id(int) of the change or 0 $differenceEngine:DifferenceEngine object $change:RecentChange object $user:User object representing the current user 'DifferenceEngineNewHeader':Allows extensions to change the $newHeader variable, which contains information about the new revision, such as the revision 's author, whether the revision was marked as a minor edit or not, etc. $differenceEngine:DifferenceEngine object & $newHeader:The string containing the various #mw-diff-otitle[1-5] divs, which include things like revision author info, revision comment, RevisionDelete link and more $formattedRevisionTools:Array containing revision tools, some of which may have been injected with the DiffRevisionTools hook $nextlink:String containing the link to the next revision(if any) $status
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults also a ContextSource after deleting those rows but within the same transaction you ll probably need to make sure the header is varied on and they can depend only on the ResourceLoaderContext $context
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses & $html
Allows to change the fields on the form that will be generated $name
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses after processing & $attribs
usually copyright or history_copyright This message must be in HTML not wikitext if the section is included from a template $section
Interface for objects which can provide a MediaWiki context on request.