Šablona:MediaWiki Hook
Zkopírování šablony a její vložení
MyHook | |
---|---|
Dostupné od version ??? |
|
Definice funkce: |
public static function onMyHook( $x, $y ) { ... }
|
Registrace háčku: |
{
"Hooks": {
"MyHook": "MyExtensionHooks::onMyHook"
}
}
|
Volá se z: | Soubor(y): |
Interface: | MyHookHook.php |
Další informace o háčcích najdete na manuálové stránce pro Manuál:Háčky (hooks) .
Chcete-li vědět, jaká rozšíření tento háček používají, podívejte se na Category:MyHook extensions/cs.
{{MediaWikiHook |name = MyHook |version = |gerrit = |removed = |summary = |args = $x, $y |source = |sourcefunction = |sourceclass = |newvarname = |newvarlink = }}
Poznámky k použití
A card which describes the information of a MediaWiki-registered hook.
Parameter | Description | Type | Status | |
---|---|---|---|---|
Template mode | 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. | Unknown | optional |
Name | name | The name of the hook. This is usually the same name as the sub-page. | Unknown | optional |
Version | version | The version of MediaWiki this hook was first introduced in. | Unknown | suggested |
Version removed | removed | If the hook has been removed, the version of MediaWiki that it was removed in. | String | optional |
Message for removed hook | removed-msg | If it is not suitable to use either the "newvarname" or the "newvarlink" template parameter, use this parameter. This parameter can be used to explain why it was removed, or for example, explain why there is no suitable replacement. | String | optional |
Version deprecated | deprecated | If the hook has been deprecated (but not removed), the version of MediaWiki that it was deprecated in. | Unknown | optional |
Message for deprecated hook | deprecated-msg | If it is not suitable to use either the "newvarname" or the "newvarlink" template parameter, use this parameter. This parameter can be used to explain why it was removed, or for example, explain why there is no suitable replacement. | String | optional |
New variable name | newvarname | For removed or deprecated hooks, the name of the hook that should be used instead | Unknown | optional |
New variable link | newvarlink | For removed or deprecated hooks, the link to the hook that should be used instead | Unknown | optional |
SVN revision introduced | 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. [[phabricator:rSVN1]]). | Unknown | optional |
Gerrit changeset | 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. Gerrit change 1) | Unknown | suggested |
Summary | summary | A short description of the hook's purpose. More detailed descriptions are desirable, and should be added to the main page content. | Unknown | required |
Arguments | args | The arguments, as used at the top of the function. | Unknown | required |
Extension | extension | no description | Unknown | optional |
File source | source | Location (file name/path not including <code>includes/</code>) which calls this hook in the code. Further locations can be added via source2...source10. | Unknown | suggested |
File source 2 | source2 | no description | Unknown | optional |
File source 3 | source3 | no description | Unknown | optional |
File source 4 | source4 | no description | Unknown | optional |
File source 5 | source5 | no description | Unknown | optional |
File source 6 | source6 | no description | Unknown | optional |
File source 7 | source7 | no description | Unknown | optional |
File source 8 | source8 | no description | Unknown | optional |
File source 9 | source9 | no description | Unknown | optional |
File source 10 | source10 | no description | Unknown | optional |
Function source | sourcefunction | Name of the function which calls this hook. Another can be added via sourcefunction2. | Unknown | suggested |
Function source 2 | sourcefunction2 | no description | Unknown | optional |
Class source | sourceclass | Name of the class which calls this hook. | Unknown | suggested |
- name
- Jméno háčku. Obvykle má stejné jméno jako podstránka.
- version
- Verze MediaWiki, ve které se tento háček prvně objevil.
- rev
- Revize SVN, ve které byl tento háček poprvé představen. Pokud je tento parametr uveden, bude odkazovat na příslušnou stránku CodeReview (např. phabricator:rSVN1).
- gerrit
- Číslo změny Gerritu, ve kterém byl tento háček poprvé představen. Pokud je tento parametr zadán, bude odkazovat na příslušnou stránku Gerritových změn (např. Gerrit change 1)
- removed
- Pokud byl háček odstraněn, verze MediaWiki, ve které byl odstraněn.
- deprecated
- Pokud byl háček zastaralý (ale nebyl odstraněn), verze MediaWiki, ve které byl zastaralý.
- summary
- Krátký popis k použití háčku.
- Je dobré přidat podrobnější popis, ideálně ho přidat k obsahu hlavní stránky.
- Pokud aktualizujete stručný popis, zaktualizujte prosím také dvě tabulky na stránce Manuál:Háčky (hooks) .
- 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
- Jméno třídy, co volá tento háček.
- 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
- Háčky přidané do 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 version
and gerrit
attributes of this template, you may need to search the history of the docs/hooks.txt file.
- (From the top-level of a Git clone of MediaWiki source code)
- Find the oldest commit to
hooks.txt
that mentions the hook:git grep <hook-name-here> $(git rev-list --all -- docs/hooks.txt) -- docs/hooks.txt | tail -n 1
- Find its Gerrit ID:
git log <commit-from-above>
- Copy the change-id from the log entry into the Gerrit search box
- Select the relevant change, and get its ID
- Find out what release the hook was first included in:
git tag --contains <commit-from-above>