Difference between revisions of "Template:Extension"

From WPRDC Wiki
Jump to navigation Jump to search
>Kghbln
(make the content collapsible)
>Uzume
(expand number of hooks supported from 48 to 90 by switching from Template:Foreach to Template:Fe)
Line 278: Line 278:
<div class="mw-collapsible-content plainlist"><ul><li><!--
<div class="mw-collapsible-content plainlist"><ul><li><!--
       -->{{#ifeq:{{{templatemode|<noinclude>nocats</noinclude>}}}|nocats|<!--
       -->{{#ifeq:{{{templatemode|<noinclude>nocats</noinclude>}}}|nocats|<!--
         -->{{Foreach|Extension/HookInUseNoCats|delim=</li><li>|<!--
         -->{{Fe|Extension/HookInUseNoCats|delim=</li><li>|<!--
             -->{{{hook1}}}|{{{hook2|}}}|{{{hook3|}}}|{{{hook4|}}}|{{{hook5|}}}|{{{hook6|}}}|<!--
             -->{{{hook1}}}|{{{hook2|}}}|{{{hook3|}}}|{{{hook4|}}}|{{{hook5|}}}|{{{hook6|}}}|<!--
             -->{{{hook7|}}}|{{{hook8|}}}|{{{hook9|}}}|{{{hook10|}}}|{{{hook11|}}}|{{{hook12|}}}|<!--
             -->{{{hook7|}}}|{{{hook8|}}}|{{{hook9|}}}|{{{hook10|}}}|{{{hook11|}}}|{{{hook12|}}}|<!--
Line 286: Line 286:
             -->{{{hook31|}}}|{{{hook32|}}}|{{{hook33|}}}|{{{hook34|}}}|{{{hook35|}}}|{{{hook36|}}}|<!--
             -->{{{hook31|}}}|{{{hook32|}}}|{{{hook33|}}}|{{{hook34|}}}|{{{hook35|}}}|{{{hook36|}}}|<!--
             -->{{{hook37|}}}|{{{hook38|}}}|{{{hook39|}}}|{{{hook40|}}}|{{{hook41|}}}|{{{hook42|}}}|<!--
             -->{{{hook37|}}}|{{{hook38|}}}|{{{hook39|}}}|{{{hook40|}}}|{{{hook41|}}}|{{{hook42|}}}|<!--
             -->{{{hook43|}}}|{{{hook44|}}}|{{{hook45|}}}|{{{hook46|}}}|{{{hook47|}}}|{{{hook48|}}}<!--
             -->{{{hook43|}}}|{{{hook44|}}}|{{{hook45|}}}|{{{hook46|}}}|{{{hook47|}}}|{{{hook48|}}}|<!--
            -->{{{hook49|}}}|{{{hook50|}}}|{{{hook51|}}}|{{{hook52|}}}|{{{hook53|}}}|{{{hook54|}}}|<!--
            -->{{{hook55|}}}|{{{hook56|}}}|{{{hook57|}}}|{{{hook58|}}}|{{{hook59|}}}|{{{hook60|}}}|<!--
            -->{{{hook61|}}}|{{{hook62|}}}|{{{hook63|}}}|{{{hook64|}}}|{{{hook65|}}}|{{{hook66|}}}|<!--
            -->{{{hook67|}}}|{{{hook68|}}}|{{{hook69|}}}|{{{hook70|}}}|{{{hook71|}}}|{{{hook72|}}}|<!--
            -->{{{hook73|}}}|{{{hook74|}}}|{{{hook75|}}}|{{{hook76|}}}|{{{hook77|}}}|{{{hook78|}}}|<!--
            -->{{{hook79|}}}|{{{hook80|}}}|{{{hook81|}}}|{{{hook82|}}}|{{{hook83|}}}|{{{hook84|}}}|<!--
            -->{{{hook85|}}}|{{{hook86|}}}|{{{hook87|}}}|{{{hook88|}}}|{{{hook89|}}}|{{{hook90|}}}<!--
         -->}}<!--
         -->}}<!--
       -->|<!--else--><!--
       -->|<!--else--><!--
         -->{{Foreach|Extension/HookInUse|delim=</li><li>|<!--
         -->{{Fe|Extension/HookInUse|delim=</li><li>|<!--
             -->{{{hook1}}}|{{{hook2|}}}|{{{hook3|}}}|{{{hook4|}}}|{{{hook5|}}}|{{{hook6|}}}|<!--
             -->{{{hook1}}}|{{{hook2|}}}|{{{hook3|}}}|{{{hook4|}}}|{{{hook5|}}}|{{{hook6|}}}|<!--
             -->{{{hook7|}}}|{{{hook8|}}}|{{{hook9|}}}|{{{hook10|}}}|{{{hook11|}}}|{{{hook12|}}}|<!--
             -->{{{hook7|}}}|{{{hook8|}}}|{{{hook9|}}}|{{{hook10|}}}|{{{hook11|}}}|{{{hook12|}}}|<!--
Line 297: Line 304:
             -->{{{hook31|}}}|{{{hook32|}}}|{{{hook33|}}}|{{{hook34|}}}|{{{hook35|}}}|{{{hook36|}}}|<!--
             -->{{{hook31|}}}|{{{hook32|}}}|{{{hook33|}}}|{{{hook34|}}}|{{{hook35|}}}|{{{hook36|}}}|<!--
             -->{{{hook37|}}}|{{{hook38|}}}|{{{hook39|}}}|{{{hook40|}}}|{{{hook41|}}}|{{{hook42|}}}|<!--
             -->{{{hook37|}}}|{{{hook38|}}}|{{{hook39|}}}|{{{hook40|}}}|{{{hook41|}}}|{{{hook42|}}}|<!--
             -->{{{hook43|}}}|{{{hook44|}}}|{{{hook45|}}}|{{{hook46|}}}|{{{hook47|}}}|{{{hook48|}}}<!--
             -->{{{hook43|}}}|{{{hook44|}}}|{{{hook45|}}}|{{{hook46|}}}|{{{hook47|}}}|{{{hook48|}}}|<!--
            -->{{{hook49|}}}|{{{hook50|}}}|{{{hook51|}}}|{{{hook52|}}}|{{{hook53|}}}|{{{hook54|}}}|<!--
            -->{{{hook55|}}}|{{{hook56|}}}|{{{hook57|}}}|{{{hook58|}}}|{{{hook59|}}}|{{{hook60|}}}|<!--
            -->{{{hook61|}}}|{{{hook62|}}}|{{{hook63|}}}|{{{hook64|}}}|{{{hook65|}}}|{{{hook66|}}}|<!--
            -->{{{hook67|}}}|{{{hook68|}}}|{{{hook69|}}}|{{{hook70|}}}|{{{hook71|}}}|{{{hook72|}}}|<!--
            -->{{{hook73|}}}|{{{hook74|}}}|{{{hook75|}}}|{{{hook76|}}}|{{{hook77|}}}|{{{hook78|}}}|<!--
            -->{{{hook79|}}}|{{{hook80|}}}|{{{hook81|}}}|{{{hook82|}}}|{{{hook83|}}}|{{{hook84|}}}|<!--
            -->{{{hook85|}}}|{{{hook86|}}}|{{{hook87|}}}|{{{hook88|}}}|{{{hook89|}}}|{{{hook90|}}}<!--
         -->}}<!--
         -->}}<!--
       -->}}<!--
       -->}}<!--
Line 309: Line 323:
<div class="mw-collapsible-header">{{ll|Template:Extension#newhook|<translate><!--T:31--> Hooks provided</translate>}}</div>
<div class="mw-collapsible-header">{{ll|Template:Extension#newhook|<translate><!--T:31--> Hooks provided</translate>}}</div>
<div class="mw-collapsible-content plainlist"><ul><li><!--
<div class="mw-collapsible-content plainlist"><ul><li><!--
       -->{{Foreach|Extension/HookProvided|delim=</li><li>|<!--
       -->{{Fe|Extension/HookProvided|delim=</li><li>|<!--
         -->{{{newhook1}}}|{{{newhook2|}}}|{{{newhook3|}}}|{{{newhook4|}}}|{{{newhook5|}}}|{{{newhook6|}}}|<!--
         -->{{{newhook1}}}|{{{newhook2|}}}|{{{newhook3|}}}|{{{newhook4|}}}|{{{newhook5|}}}|{{{newhook6|}}}|<!--
         -->{{{newhook7|}}}|{{{newhook8|}}}|{{{newhook9|}}}|{{{newhook10|}}}|{{{newhook11|}}}|{{{newhook12|}}}|<!--
         -->{{{newhook7|}}}|{{{newhook8|}}}|{{{newhook9|}}}|{{{newhook10|}}}|{{{newhook11|}}}|{{{newhook12|}}}|<!--
Line 317: Line 331:
         -->{{{newhook31|}}}|{{{newhook32|}}}|{{{newhook33|}}}|{{{newhook34|}}}|{{{newhook35|}}}|{{{newhook36|}}}|<!--
         -->{{{newhook31|}}}|{{{newhook32|}}}|{{{newhook33|}}}|{{{newhook34|}}}|{{{newhook35|}}}|{{{newhook36|}}}|<!--
         -->{{{newhook37|}}}|{{{newhook38|}}}|{{{newhook39|}}}|{{{newhook40|}}}|{{{newhook41|}}}|{{{newhook42|}}}|<!--
         -->{{{newhook37|}}}|{{{newhook38|}}}|{{{newhook39|}}}|{{{newhook40|}}}|{{{newhook41|}}}|{{{newhook42|}}}|<!--
         -->{{{newhook43|}}}|{{{newhook44|}}}|{{{newhook45|}}}|{{{newhook46|}}}|{{{newhook47|}}}|{{{newhook48|}}}<!--
         -->{{{newhook43|}}}|{{{newhook44|}}}|{{{newhook45|}}}|{{{newhook46|}}}|{{{newhook47|}}}|{{{newhook48|}}}|<!--
        -->{{{newhook49|}}}|{{{newhook50|}}}|{{{newhook51|}}}|{{{newhook52|}}}|{{{newhook53|}}}|{{{newhook54|}}}|<!--
        -->{{{newhook55|}}}|{{{newhook56|}}}|{{{newhook57|}}}|{{{newhook58|}}}|{{{newhook59|}}}|{{{newhook60|}}}|<!--
        -->{{{newhook61|}}}|{{{newhook62|}}}|{{{newhook63|}}}|{{{newhook64|}}}|{{{newhook65|}}}|{{{newhook66|}}}|<!--
        -->{{{newhook67|}}}|{{{newhook68|}}}|{{{newhook69|}}}|{{{newhook70|}}}|{{{newhook71|}}}|{{{newhook72|}}}|<!--
        -->{{{newhook73|}}}|{{{newhook74|}}}|{{{newhook75|}}}|{{{newhook76|}}}|{{{newhook77|}}}|{{{newhook78|}}}|<!--
        -->{{{newhook79|}}}|{{{newhook80|}}}|{{{newhook81|}}}|{{{newhook82|}}}|{{{newhook83|}}}|{{{newhook84|}}}|<!--
        -->{{{newhook85|}}}|{{{newhook86|}}}|{{{newhook87|}}}|{{{newhook88|}}}|{{{newhook89|}}}|{{{newhook90|}}}<!--
       -->}}<!--
       -->}}<!--
   --></li></ul></div>
   --></li></ul></div>
Line 492: Line 513:
|bugzilla        = {{{bugzilla}}}
|bugzilla        = {{{bugzilla}}}
|phabricator    = {{{phabricator}}}
|phabricator    = {{{phabricator}}}
|vagrant-role    = {{{vagrant-role}}}
|vagrant-role    = {{{vagrant-role}}}
|pagedrive1      = true
|pagedrive1      = true
|demo            = true
|demo            = true
Line 539: Line 560:
<td>'''type1'''<br/>''type2''<br/>''type3''<br/>''type4''<br/>''type5''<br/>''type6''<br/></td><td><span id="type">'''<translate><!--T:61--> implementation type</translate>'''</span><!-- id here so at top of documentation -->
<td>'''type1'''<br/>''type2''<br/>''type3''<br/>''type4''<br/>''type5''<br/>''type6''<br/></td><td><span id="type">'''<translate><!--T:61--> implementation type</translate>'''</span><!-- id here so at top of documentation -->


The implementation strategy(s) employed in building this extension. This parameter is used to create categories that help programmers find examples of various MediaWiki specific implementation strategies or patterns. Although the values of this parameter sometimes coincide with the use case or purpose of an extension, that is not reason for this parameter. If the values you have chosen for this parameter do not adequately identify the [[w:Requirements|purpose]] or possible [[w:Use case|use case]]s, we recommend you add additional [[Help:Categories|category links]] as needed.
The implementation strategy(s) employed in building this extension. This parameter is used to create categories that help programmers find examples of various MediaWiki specific implementation strategies or patterns. Although the values of this parameter sometimes coincide with the use case or purpose of an extension, that is not reason for this parameter. If the values you have chosen for this parameter do not adequately identify the [[w:Requirements|purpose]] or possible [[w:Use case|use case]]s, we recommend you add additional [[Help:Categories|category links]] as needed.


Legal values for the '''type1''', '''type2''', ... parameters are:
Legal values for the '''type1''', '''type2''', ... parameters are:
Line 585: Line 606:


For custom hooks defined by extensions:
For custom hooks defined by extensions:
* use ''extensionName''/''hookName''. For a partial list of custom hooks, see [[Extension hook registry]].
* use ''extensionName''/''hookName''. For a partial list of custom hooks, see [[Extension hook registry]].


For multiple hooks, assign the first hook to '''hook1''', the second to '''hook2''' and so on.</td>
For multiple hooks, assign the first hook to '''hook1''', the second to '''hook2''' and so on.</td>
Line 705: Line 726:
<td>'''templatemode'''</td><td>'''Controls auto-categorization of host page.'''
<td>'''templatemode'''</td><td>'''Controls auto-categorization of host page.'''


Normally left blank. Alternate values are:
Normally left blank. Alternate values are:
* ''nocats'' - suppresses categorization and the 'check usage' link. Use this value if you are adding this template to [[Help:Subpage|subpages]] of an extension or to how-to documentation of extensions. For example, the usage image above sets <code>templatemode=nocats</code> because this isn't an actual extension page and we don't want to add this page to any categories on account of it.
* ''nocats'' - suppresses categorization and the 'check usage' link. Use this value if you are adding this template to [[Help:Subpage|subpages]] of an extension or to how-to documentation of extensions. For example, the usage image above sets <code>templatemode=nocats</code> because this isn't an actual extension page and we don't want to add this page to any categories on account of it.
* ''nousage'' - suppresses the 'check usage' link. Link is also suppressed if the page is a subpage; it is not in the Extension: namespace; or if suppressed by 'templatemode=nocats'
* ''nousage'' - suppresses the 'check usage' link. Link is also suppressed if the page is a subpage; it is not in the Extension: namespace; or if suppressed by 'templatemode=nocats'




Line 748: Line 769:
</translate>
</translate>
* '''[[Template:Extension/Sample]]:''' The boilerplate extension that is preloaded into newly-created pages.
* '''[[Template:Extension/Sample]]:''' The boilerplate extension that is preloaded into newly-created pages.
* '''[[Template:Extension/CreateExtensionInputBox]]:''' An input box that can be inserted wherever you want users to easily create extensions. For documentation on the <code><nowiki><inputbox></nowiki></code> tag, please see [[Extension:InputBox]].
* '''[[Template:Extension/CreateExtensionInputBox]]:''' An input box that can be inserted wherever you want users to easily create extensions. For documentation on the <code><nowiki><inputbox></nowiki></code> tag, please see [[Extension:InputBox]].


=== Infobox parameters ===
=== Infobox parameters ===
In general:
In general:
* To make this template easy to use, each label in the infobox is linked to documentation on the template parameter(s) it displays. If you add a parameter, please be sure to also add it to the [[Template:Extension#Content parameters|content parameter documentation]] and link its label to that documentation.
* To make this template easy to use, each label in the infobox is linked to documentation on the template parameter(s) it displays. If you add a parameter, please be sure to also add it to the [[Template:Extension#Content parameters|content parameter documentation]] and link its label to that documentation.


To change/correct/add to the implementation type parameters:
To change/correct/add to the implementation type parameters:
* Check the [[Template_talk:Extension|talk page]] - there have been some extensive discussions about this field.
* Check the [[Template_talk:Extension|talk page]] - there have been some extensive discussions about this field.
* '''[[Template:Extension/TypeSwitch]]:''' Stores the possible values for the type field. Multiple values are implemented by calling this template with [[Template:Foreach]].
* '''[[Template:Extension/TypeSwitch]]:''' Stores the possible values for the type field. Multiple values are implemented by calling this template with [[Template:Fe]].
* '''[[Template:Extension/TypeSwitchNoCats]]:''' Does not need to be modified when adding a new type. Used instead of [[Template:Extension/TypeSwitch]] when this template is used in <code>templatemode=nocats</code>. Templates used with [[Template:Foreach]] can only take one parameter so we need to wrap the call to [[Template:Extension/TypeSwitch]] with another template that sets the mode.
* '''[[Template:Extension/TypeSwitchNoCats]]:''' Does not need to be modified when adding a new type. Used instead of [[Template:Extension/TypeSwitch]] when this template is used in <code>templatemode=nocats</code>. Templates used with [[Template:Fe]] can only take one parameter so we need to wrap the call to [[Template:Extension/TypeSwitch]] with another template that sets the mode.


To change the behavior of the hook parameters:
To change the behavior of the hook parameters:
* '''[[Template:Extension/HookInUse]]:''' Adds links and categories for a hook in use. Multiple hooks in use are implemented by calling this template with [[Template:Foreach]].
* '''[[Template:Extension/HookInUse]]:''' Adds links and categories for a hook in use. Multiple hooks in use are implemented by calling this template with [[Template:Fe]].
* '''[[Template:Extension/HookInUseNoCats]]:''' Used instead of [[Template:Extension/HookInUse]] when this template is used in <code>templatemode=nocats</code>. Templates used with [[Template:Foreach]] can only take one parameter so we need to wrap the call to [[Template:Extension/HookInUse]] with another template that sets the mode.
* '''[[Template:Extension/HookInUseNoCats]]:''' Used instead of [[Template:Extension/HookInUse]] when this template is used in <code>templatemode=nocats</code>. Templates used with [[Template:Fe]] can only take one parameter so we need to wrap the call to [[Template:Extension/HookInUse]] with another template that sets the mode.


== Test case ==
== Test case ==

Revision as of 23:52, 12 October 2019

<languages/> Lua error in Module:TNT at line 158: Missing JsonConfig extension; Cannot load https://commons.wikimedia.org/wiki/Data:I18n/Documentation.tab.[[Category:Template documentation pages{{#translation:}}]] Maintenance: vulnerabilities, archived

[[Category:Info templates{{#translation:}}|Extension]] [[Category:Extension creation{{#translation:}}]] [[Category:Categorizing templates{{#translation:}}|Extension]] [[Category:Extension templates{{#translation:}}]]