Content deleted Content added
No edit summary |
mNo edit summary |
||
(30 intermediate revisions by 24 users not shown) | |||
Line 1:
{{High-use
{{Module rating|protected}}
{{Lua|Module:Protection banner/config|Module:File link|Module:Effective protection level|Module:Effective protection expiry|Module:Yesno|Module:Arguments|Module:Message box|Module:Submit an edit request}}
This module creates protection banners and padlock icons that are placed at the top of [[Help:Protection|protected pages]].
Line 15 ⟶ 16:
| small = ''yes/no''
| action = ''action''
| date = ''protection date''
| user = ''username''
| section = ''talk page section name''
| category = ''
}}
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
'''''Note:''' You
=== From Lua ===
Line 30:
First, load the module.
<
local mProtectionBanner = require('Module:Protection banner')
</syntaxhighlight>
Then you can make protection banners by using the _main function.
<
mProtectionBanner._main(args, cfg, titleObj)
</syntaxhighlight>
<var>args</var> is a 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.
Line 46:
All parameters are optional.
* '''1'''
* '''small'''
* '''action'''
* '''date'''
* '''user''' – the username of the user to generate links for. As of July 2014, this only has an effect when the "usertalk" reason is specified.
▲* '''date''' - the protection date. This must be valid input to the second parameter of the [[mw:Help:Extension:ParserFunctions##time|#time parser function]]. This argument has an effect for reasons that use the PROTECTIONDATE parameter in their configuration. As of July 2014, those were the "office" and "reset" reasons.
* '''
* '''catonly''' – if set to "yes", "y", "1", or "true", will only return the protection categories, and not return the banner or padlock. This has no visible output.
▲* '''category''' - categories are suppressed if this is set to "no", "n", "0", or "false".
== Reasons ==
Line 64:
Below is a list of some of the common errors that this module can produce, and how to fix them.
=== Invalid protection date ===
Line 77 ⟶ 69:
{{error|Error: invalid protection date ("abc")}}
This error is produced if you supply
=== Invalid action ===
Line 102 ⟶ 94:
Bug reports and feature requests should be made on [[w:en:Module talk:Protection banner|the module's talk page]].
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox||
<!-- Categories go here and interwikis go in Wikidata. -->
}}</includeonly>
|