Template:ExtensionHook
<languages />
Lua error: Module:TNT:172: '''Missing JsonConfig extension, or not properly configured; Cannot load https://commons.wikimedia.org/wiki/Data:I18n/Documentation.tab. See https://www.mediawiki.org/wiki/Extension:JsonConfig#Supporting_Wikimedia_templates'''.{{#if:<translate>
Copy and paste template
</translate> {{#switch:<translate></translate> | = {{#ifeq:nocats|nocats|
| Template:IfNotEn {{#if: | Template:Removed | {{#if: | Template:Deprecated | }} }}
}}
{{#if:MyHook|MyHook|{{#titleparts:ExtensionHook|1|2}}}} | |
---|---|
<translate> Available from version <tvar name=1>{{#switch:||?|??|???|????=???|#default=}} {{#if:|([[phabricator:rSVN{{{rev}}}|r{{{rev}}}]])|{{#if:|(Gerrit change )}}}}</tvar></translate>{{#if:| <translate> Removed in version <tvar name=1></tvar></translate>Template:IfNotEn|}} |
|
<translate> Define function:</translate> | <syntaxhighlight lang="php">
public static function onMyHook( $x, $y ) { ... } </syntaxhighlight> |
<translate> Attach hook:</translate> | <syntaxhighlight lang="php">
$wgHooks['MyHook'][] = 'MyExtensionHooks::onMyHook'; </syntaxhighlight> |
<translate> Called from:</translate> | <translate> File(s):</translate>{{#if:| [[Special:MyLanguage/Extension:|]] /}} Template:Foreach{{#if: | <translate> Function(s):</translate> {{#if: |Template:Class doclink|}}{{#if: |, {{{sourcefunction2}}}}}}} |
<translate> For more information about attaching hooks, see <tvar name=1>{{#ifeq:Manual:Hooks|
|
}}[[Special:MyLanguage/Manual:Hooks|{{#if: |{{{2}}} |{{#ifexist:Translations:{{#if:|:}}Manual:Hooks/Page display title/en
|{{#if: |{{#if: | |{{ Template:TNTN | nsp = 0 }} }} |{{ Template:TNTN }} }} |{{#if: |{{#if:Manual:Hooks |Manual:Hooks |Manual:Hooks }} |Manual:Hooks }}
}}}}]]{{#ifeq:Manual:Hooks|
|
}}
{{#if:||<translate> For examples of other extensions using this hook, see <tvar name=cat>[[:Category:{{#if:MyHook|MyHook|{{#titleparts:ExtensionHook|1|3}}}} extensions{{#translation:}}]]</tvar>.</translate>}}
| #default=
Lua error: expandTemplate: template loop detected.
}}
{{ExtensionHook |name = MyHook |version = |gerrit = |removed = |summary = |args = $x, $y |extension = |source = |sourcefunction = |sourceclass = |newvarname = |newvarlink = |nocatdesc = }}
<translate>
Usage notes
</translate>
- name
- <translate> The name of the hook.</translate> <translate> This is usually the same name as the sub-page.</translate>
- version
- <translate> The version of MediaWiki this hook was first introduced in.</translate>
- rev
- <translate> SVN revision in which this hook was first introduced.</translate> <translate> If this parameter is given, it will link to the appropriate CodeReview page (e.g. <tvar name=1>r115794</tvar>).</translate>
- gerrit
- <translate> Gerrit change number in which this hook was first introduced.</translate> <translate> If this parameter is given, it will link to the appropriate Gerrit changeset page (e.g., [[<tvar name=1>gerrit:5</tvar>|Gerrit change 5]])</translate>
- removed
- <translate> If the hook has been removed, the version of MediaWiki that it was removed in.</translate>
- deprecated
- <translate> If the hook has been deprecated (but not removed), the version of MediaWiki that it was deprecated in.</translate>
- summary
- <translate> A short description of the hook's purpose.</translate>
- <translate> More detailed descriptions are desirable, and should be added to the main page content.</translate>
- <translate> If you update the short description, please also update the two tables on <tvar name=man>{{#ifeq:Manual:Hooks|
|
}}[[Special:MyLanguage/Manual:Hooks|{{#if: |{{{2}}} |{{#ifexist:Translations:{{#if:|:}}Manual:Hooks/Page display title/en
|{{#if: |{{#if: | |{{ Template:TNTN | nsp = 0 }} }} |{{ Template:TNTN }} }} |{{#if: |{{#if:Manual:Hooks |Manual:Hooks |Manual:Hooks }} |Manual:Hooks }}
}}}}]]{{#ifeq:Manual:Hooks|
|
}}
</tvar>.</translate>- args
- <translate> The arguments, as used at the top of the function.</translate>
- extension
- Extension name where hook is called; for when the source is not in the MediaWiki core code repository.
- source
- <translate> Location (file name) which calls this hook in the code. Further locations can be added via <tvar name=1>source2...source10</tvar>.</translate>
- sourcefunction
- <translate> Name of the function which calls this hook. Another can be added via <tvar name=1>sourcefunction2</tvar>.</translate>
- sourceclass
- <translate> Name of the class which calls this hook.</translate>
- newvarname
- <translate> Used by <tvar name=1>{{Removed}}</tvar> or <tvar name=2>{{Deprecated}}</tvar> when <tvar name=3>removed</tvar> or <tvar name=4>deprecated</tvar> is set.</translate>
- newvarlink
- <translate> Used by <tvar name=1>{{Removed}}</tvar> or <tvar name=2>{{Deprecated}}</tvar> when <tvar name=3>removed</tvar> or <tvar name=4>deprecated</tvar> is set.</translate>
- templatemode
- <translate> Set to <tvar name=nocats>nocats</tvar> if hook documentation should not appear in standard MediaWiki Categories.</translate>
- <translate> By default, using this template places the documentation page into categories:</translate>
- <translate> MediaWiki hooks</translate>
- <translate> Hooks added in MediaWiki...</translate>
- <translate> There are times when it is undesirable to automatically categorise the hook documentation.</translate> <translate> Examples would include when documenting a hook in an extension, or when documenting the template itself.</translate>
- nocatdesc
- <translate> If a hook is removed completely from MediaWiki version by setting <tvar name=1>
yes
</tvar>, it will not show up the category description.</translate>
Template data
<translate>
See also
</translate>
- {{#ifeq:Template:MediaWikiHook|
|
}}[[Special:MyLanguage/Template:MediaWikiHook|{{#if: |{{{2}}} |{{#ifexist:Translations:{{#if:Template|Template:}}MediaWikiHook/Page display title/en
|{{#if: |{{#if: | |{{ Template:TNTN | nsp = 0 }} }} |{{ Template:TNTN }} }} |{{#if: |{{#if:MediaWikiHook |MediaWikiHook |Template:MediaWikiHook }} |Template:MediaWikiHook }}
}}}}]]{{#ifeq:Template:MediaWikiHook|
|
}}
| [[Category:Template documentation pages{{#translation:}}]] }}[[Category:Infobox templates{{#translation:}}|ExtensionHook]] [[Category:Categorizing templates{{#translation:}}|ExtensionHook]] [[Category:Hook templates{{#translation:}}|ExtensionHook]]