Template:MediaWikiHook

{{#switch: {{#ifeq:{{{templatemode|}}}|nocats| }} {{#if:{{{removed|}}} |{{Removed|{{{removed}}}|{{{removed-msg|}}}|newvarname={{{newvarname|}}}|newvarlink={{{newvarlink|}}}|name=}}} }} |{{#if:{{{deprecated|}}} |{{Deprecated|{{{deprecated}}}|{{{deprecated-msg|}}}|newvarname={{{newvarname|}}}|newvarlink={{{newvarlink|}}}|name={{#if:{{{name|}}}|{{{name}}}|{{#if:{{{deprecated-msg|{{#titleparts:{{PAGENAME}}|1|2}}}}}}} }} |   }}  }} }} '' For more information about attaching hooks, see man>Special:MyLanguage/Manual:Hooks|Manual:Hooks. ''
 * {{IfNotEn|

'' For examples of extensions using this hook, see }}}|{{{name}}}|{{#titleparts:{{PAGENAME}}|1|2}}}} extensions. '' }} {{Documentation|content=
 * #default=

Usage notes
{	"params": { "templatemode": { "description": "Set to nocats if hook documentation should not appear in standard MediaWiki Categories. By default, using this template places the documentation page into categories: MediaWiki hooks Hooks added in MediaWiki... There are times when it is undesirable to automatically categorize the hook documentation. Examples would include when documenting a hook in an extension, or when documenting the template itself.", "label": "Template mode" },		"name": { "description": "The name of the hook. This is usually the same name as the sub-page.", "label": "Name" },		"version": { "description": "The version of MediaWiki this hook was first introduced in.", "suggested": true, "label": "Version" },		"removed": { "description": "If the hook has been removed, the version of MediaWiki that it was removed in.", "type": "string", "label": "Version removed" },		"newvarname": { "label": "New variable name" },		"newvarlink": { "label": "New variable link" },		"deprecated": { "description": "If the hook has been deprecated (but not removed), the version of MediaWiki that it was deprecated in.", "label": "Version deprecated" },		"rev": { "description": "SVN revision in which this hook was first introduced. If this parameter is given, it'll link to the appropriate CodeReview page (e.g. Special:Code/MediaWiki/1).", "label": "SVN revision introduced" },		"gerrit": { "description": "Gerrit change number in which this hook was first introduced. If this parameter is given, it'll link to the appropriate Gerrit changeset page (e.g. Gerrit change 1)", "suggested": true, "label": "Gerrit changeset" },		"summary": { "description": "A short description of the hook's purpose. More detailed descriptions are desirable, and should be added to the main page content.", "required": true, "label": "Summary" },		"args": { "description": "The arguments, as used at the top of the function.", "required": true, "label": "Arguments" },		"extension": { "label": "Extension" },		"source": { "description": "Location (file name/path not including ) which calls this hook in the code. Further locations can be added via source2...source10.", "suggested": true, "label": "File source" },		"source2": { "label": "File source 2" },		"source3": { "label": "File source 3" },		"source4": { "label": "File source 4" },		"source5": { "label": "File source 5" },		"source6": { "label": "File source 6" },		"source7": { "label": "File source 7" },		"source8": { "label": "File source 8" },		"source9": { "label": "File source 9" },		"source10": { "label": "File source 10" },		"sourcefunction": { "description": "Name of the function which calls this hook. Another can be added via sourcefunction2.", "suggested": true, "label": "Function source" },		"sourceclass": { "description": "Name of the class which calls this hook.", "suggested": true, "label": "Class source" },		"sourcefunction2": { "label": "Function source 2" }	},	"format": "block", "description": "A card which describes the information of a MediaWiki-registered hook.", "paramOrder": [ "templatemode", "name", "version", "removed", "newvarname", "newvarlink", "deprecated", "rev", "gerrit", "summary", "args", "extension", "source", "source2", "source3", "source4", "source5", "source6", "source7", "source8", "source9", "source10", "sourcefunction", "sourcefunction2", "sourceclass" ] }


 * name
 * The name of the hook. This is usually the same name as the sub-page.


 * version
 * The version of MediaWiki this hook was first introduced in.


 * rev
 * SVN revision in which this hook was first introduced. If this parameter is given, it'll link to the appropriate CodeReview page (e.g. Special:Code/MediaWiki/1).


 * gerrit
 * Gerrit change number in which this hook was first introduced. If this parameter is given, it'll link to the appropriate Gerrit changeset page (e.g. [https://gerrit.wikimedia.org/r/#/c/1/ Gerrit change 1])


 * removed
 * If the hook has been removed, the version of MediaWiki that it was removed in.


 * deprecated
 * If the hook has been deprecated (but not removed), the version of MediaWiki that it was deprecated in.


 * summary
 * A short description of the hook's purpose.
 * More detailed descriptions are desirable, and should be added to the main page content.
 * If you update the short description, please also update the two tables on .


 * args
 * The arguments, as used at the top of the function.


 * source
 * Location (file name) which calls this hook in the code. Further locations can be added via source2...source10.


 * sourcefunction
 * Name of the function which calls this hook. Another can be added via sourcefunction.


 * sourceclass
 * Name of the class which calls this hook.


 * templatemode
 * Set to nocats if hook documentation should not appear in standard MediaWiki Categories.
 * By default, using this template places the documentation page into categories:
 * MediaWiki hooks
 * Hooks added in MediaWiki...
 * There are times when it is undesirable to automatically categorize the hook documentation. Examples would include when documenting a hook in an extension, or when documenting the template itself.

Finding a hook's version and Gerrit ID
To populate the   and   attributes of this template, you may need to search the history of the </> file.


 * 1) ( From the top-level of a Git clone of MediaWiki source code )
 * 2) Find the oldest commit to <tvar|1> </> that mentions the hook:
 * 3) Find its Gerrit ID:
 * 4) Copy the change-id from the log entry into the Gerrit search box
 * 5) Select the relevant change, and get its ID
 * 6) Find out what release the hook was first included in:
 * 1) Select the relevant change, and get its ID
 * 2) Find out what release the hook was first included in:

}}