Template:MediaWikiHook

From Holocaustmap

<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> {{#ifeq:nocats|nocats|

 |[[Category:MediaWiki hooks{{#translation:}}|{{#if:MyHook|MyHook|{{#titleparts:MediaWikiHook|1|2}}}}]]

[[Category:Hooks added in MediaWiki {{#switch:||?|??|???|????=???|#default=}}{{#translation:}}|{{#if:MyHook|MyHook|{{#titleparts:MediaWikiHook|1|2}}}}]] {{#if:

 |Template:Removed
 |{{#if:
   |Template:Deprecated
   |
   }}
 }}

{{#if: |[[Category:Hooks removed in MediaWiki {{#translation:}}|{{#if:MyHook|MyHook|{{#titleparts:MediaWikiHook|1|2}}}}]]}} {{#if:|[[Category:Hooks deprecated in MediaWiki {{{deprecated}}}{{#translation:}}|{{#if:MyHook|MyHook|{{#titleparts:MediaWikiHook|1|2}}}}]]}} }}

aeb-arab|aic|ar|arc|arq|ary|arz|azb|bcc|bgn|bqi|bqp|ckb|ckb-arab|dv|en-rtl|fa|fa-af|glk|ha-arab|haz|he|khw|kk-arab|kk-cn|ks|ks-arab|ku-arab|lki|lrc|luz|mzn|nqo|ota|phn|pnb|prd|prs|ps|sd|sdh|skr|skr-arab|tg-arab|tly|ug|ug-arab|ur|uz-arab|xpu|ydd|yi

={{#ifeq:|-||{{#ifeq:right|right|right|rtl}}}}

#default

={{#ifeq:|-||{{#ifeq:left|left|left|ltr}}}} }}; border: 1px solid #a2a9b1; border-collapse: collapse; margin: auto; clear: both;" cellpadding="5"

{{#if:MyHook|MyHook|{{#titleparts:MediaWikiHook|1|2}}}}
{{#ifexist:MediaWiki <translate> Available from <tvar name=1>[[Special:MyLanguage/MediaWiki |Template:Version]] {{#if:|([[phabricator:rSVN{{{rev}}}|r{{{rev}}}]], codereview)|{{#if:|(Gerrit change )}}}}</tvar></translate> <translate> Available from <tvar name=1>Template:Version {{#if:|([[phabricator:rSVN{{{rev}}}|r{{{rev}}}]], codereview)|{{#if:|(Gerrit change )}}}}</tvar></translate>
 }}{{#if:|
{{#ifexist:MediaWiki
<translate> Removed in <tvar name=1>[[Special:MyLanguage/MediaWiki |Template:Version]] {{#if:|(Gerrit change )}}</tvar></translate> <translate> Removed in <tvar name=1>Template:Version {{#if:|(Gerrit change )}}</tvar></translate>

}}Template:IfNotEn|}}

<translate> Define function:</translate> <syntaxhighlight lang="php">

public static function onMyHook( $x, $y ) { ... } </syntaxhighlight>

<translate> Attach hook:</translate> <translate> In <tvar name=1>Template:Manual</tvar>:</translate>

<syntaxhighlight lang="json"> { "Hooks": { "MyHook": "MediaWiki\\Extension\\MyExtension\\Hooks::onMyHook" } } </syntaxhighlight>

<translate> Called from:</translate> [[Extension:{{{extension}}}|{{{extension}}}]] /}} Template:Foreach{{#if: |
<translate> Function(s):</translate> {{#if: |Template:Class doclink|}}{{#if: |, {{{sourcefunction2}}}}}}}
<translate> Interface:</translate> MyHookHook.php|{{#titleparts:MediaWikiHook|1|2}}Hook.php}}

<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|

 |

}} </tvar>.</translate>
{{#if:||<translate> For examples of extensions using this hook, see <tvar name=cat>[[:Category:{{#if:MyHook|MyHook|{{#titleparts:MediaWikiHook|1|2}}}} extensions{{#translation:}}]]</tvar>.</translate>}}

{{MediaWikiHook
|name = MyHook
|version =
|gerrit =
|gerritremoved =
|removed =
|summary =
|args = $x, $y
|source =
|sourcefunction =
|sourceclass =
|newvarname =
|newvarlink =
|nocatdesc =
}}

<translate>

Usage notes

</translate>

Template:MediaWikiHook/doc

<translate>

Finding a hook's version and Gerrit ID

To populate the <tvar name=1>version</tvar> and <tvar name=2>gerrit</tvar> attributes of this template, you may need to search the history of the <tvar name=3>Template:Git file</tvar> file. </translate>

  1. (<translate> From the top-level of a Git clone of MediaWiki source code</translate>)
  2. <translate> Find the oldest commit to <tvar name=1>hooks.txt</tvar> that mentions the hook:</translate>
    • git grep <<translate> hook-name-here</translate>> $(git rev-list --all -- docs/hooks.txt) -- docs/hooks.txt | tail -n 1
  3. <translate> Find its Gerrit ID:</translate>
    • git log <<translate> commit-from-above</translate>>
    1. <translate> Copy the change-id from the log entry into the Gerrit search box</translate>
    2. <translate> Select the relevant change, and get its ID</translate>
  4. <translate> Find out what release the hook was first included in:</translate>
    • git tag --contains <<translate> commit-from-above</translate>>|

[[Category:Template documentation pages{{#translation:}}]] }}

[[Category:Infobox templates{{#translation:}}|MediaWikiHook]] [[Category:Categorizing templates{{#translation:}}|MediaWikiHook]] [[Category:Hook templates{{#translation:}}|MediaWikiHook]]