މޮޑިއުލް:Protection banner/doc: Difference between revisions

Content deleted Content added
Created page with "This module creates protection banners and padlock icons that are placed at the top of protected pages. == Usage == Most users will not need to use this..."
 
m Bot: Replace deprecated <source> tag and "enclose" parameter; cosmetic changes
 
ފޮޅުވަތް 1:
This module creates protection banners and padlock icons that are placed at the top of [[Helpއެހީ:Protection|protected pages]].
 
== Usage ==
ފޮޅުވަތް 9:
=== From wikitext ===
 
&#123;{{#invoke:Protection banner|main
| 1 = ''reason''
| small = ''yes/no''
ފޮޅުވަތް 18:
| section = ''talk page section name''
| category = ''no''
}&#125;}
 
The #invoke syntax can be used for creating protection templates more specific than {{tl|pp}}. For example, it is possible to create a protection template which always shows a padlock icon by using the code <code><nowiki>{{#invoke:Protection banner|main|small=yes}}</nowiki></code>. Pages which call this template will still be able to use other arguments, like ''action'' and ''expiry''. However, this only works one level deep; a page calling a template which calls another template containing the above code will not automatically be able to use parameters like ''action'' and ''expiry''.
ފޮޅުވަތް 26:
First, load the module.
 
<sourcesyntaxhighlight lang="lua">
local mProtectionBanner = require('Module:Protection banner')
</syntaxhighlight>
</source>
 
Then you can make protection banners by using the _main function.
 
<sourcesyntaxhighlight lang="lua">
mProtectionBanner._main(args, cfg, titleObj)
</syntaxhighlight>
</source>
 
<var>args</var> is an table of arguments to pass to the module. For possible keys and values for this table, see the [[#Parameters|parameters section]]. The <var>cfg</var> and <var>titleObj</var> variables are intended only for testing; <var>cfg</var> specifies a customised config table to use instead of [[Moduleމޮޑިއުލް:Protection banner/config]], and <var>titleObj</var> specifies a mw.title object to use instead of the current title. <var>args</var>, <var>cfg</var> and <var>titleObj</var> are all optional.
 
== Parameters ==
ފޮޅުވަތް 77:
{{error|Error: invalid action ("abc")}}
 
This error is produced if you specify an invalid protection action. There are only three valid actions: <code>edit</code> (the default, for normal protection), <code>move</code> (for move-protection), and <code>autoreview</code> (for [[WP:PC|pending changes]]). This should only be possible if you are using a template that supports manually specifying the protection action, such as {{tl|pp}}, or if you are using #invoke directly. If this is not the case, please leave a message on [[Moduleމޮޑިއުލް talkޚިޔާލު:Protection banner]].
 
=== Reasons cannot contain the pipe character ===
ފޮޅުވަތް 87:
=== Other errors ===
 
If you see an error other than the ones above, it is likely to either be a bug in the module or mistake in the configuration. Please post a message about it at [[Moduleމޮޑިއުލް talkޚިޔާލު:Protection banner]].
 
== Technical details ==
 
This module uses configuration data from [[Moduleމޮޑިއުލް:Protection banner/config]]. Most of the module's behaviour can be configured there, making it easily portable across different wikis and different languages.
 
General test cases for the module can be found at [[w:en:Module:Protection banner/testcases|Module:Protection banner/testcases]], and test cases specific to enwiki's config can be found at [[w:en:Module:Protection banner/config/testcases|Module:Protection banner/config/testcases]].