Module:Protection banner/doc
This is the documentation page for Module:Protection banner
This page documents the Chalo Chatu–only protection banner module. It provides a lightweight, dependency-free implementation for protection notices and padlock indicators. It is declarative: pages call the module (usually via Template:PP-meta) and pass action, level, reason, and dates. The module does not query actual MediaWiki protection state.
Overview
- Designed for Chalo Chatu only
- No external dependencies or WMF modules
- Outputs either a full banner or a small padlock
- Adds simple, predictable protection categories
- Icons and category names configurable in Module:Protection banner/config
How it works
Most pages should not call the module directly. Use the wrapper template:
- Template:PP-meta invokes the module with your parameters
- Module:Protection banner renders the banner/padlock and adds categories
Quick start (recommended wrapper)
Place this in the article or template needing a notice:
{{pp-meta|vandalism|action=edit|level=autoconfirmed|expiry=indef|date=2025-09-29}}
Small padlock indicator:
{{pp-meta|dispute|action=edit|level=sysop|small=yes|link=Chalo Chatu:Protection policy}}
Parameters (via Template:PP-meta)
All parameters are passed through to the module.
- 1 or reason
- Free-text reason shown in the banner line. Example: vandalism, dispute, sock.
- action
- edit (default), move, upload.
- level
- sysop, templateeditor, extendedconfirmed, autoconfirmed, * (unprotected). Determines icon, wording, and category.
- expiry
- indef for indefinite; or free text such as 2026-12-31. Shown as provided.
- date
- Free text such as 2025-09-29. Shown as Protected on 2025-09-29.
- small
- yes to output a small padlock indicator instead of a full banner.
- category
- yes (default) to add a protection category; no to suppress.
- image
- Optional file name override for the padlock icon. Example: Padlock-custom.svg
- link
- Optional page to link the padlock to when small=yes. Example: Chalo Chatu:Protection policy
- pagetype
- Defaults to page. Used in phrasing (This page is semi-protected...). You may set article, template, module, etc.
Levels and default wording
The module maps levels to human-readable phrases.
- edit/sysop
- fully protected
- edit/templateeditor
- template-protected
- edit/extendedconfirmed
- extended confirmed protected
- edit/autoconfirmed
- semi-protected
- *
- unprotected
Move and upload actions use simple default wording (move-protected, upload-protected).
Categories
When category=yes and level is not *, the module adds one category based on action/level. Defaults are set in Module:Protection banner/config:
- Fully protected pages
- Template-protected pages
- Extended-confirmed protected pages
- Semi-protected pages
- Move-protected pages
- Upload-protected pages
- Protected pages (fallback)
Rename or localize categories by editing Module:Protection banner/config.
Icons
Icons are file names stored in Module:Protection banner/config. Replace with your local files as needed:
- Padlock-red.svg, Padlock-orange.svg, Padlock-amber.svg, Padlock-yellow.svg, Padlock-blue.svg, Padlock-grey.svg
You can override per-call with image=.
Examples
Full banner, indefinite semi-protection for vandalism:
{{pp-meta|vandalism|action=edit|level=autoconfirmed|expiry=indef|date=2025-09-29}}
Full banner, extended-confirmed protection with expiry:
{{pp-meta|dispute|action=edit|level=extendedconfirmed|expiry=2026-06-30}}
Small padlock on a template:
{{pp-meta|reason=high-risk template|action=edit|level=templateeditor|small=yes|link=Chalo Chatu:Template protection}}
Suppress category (maintenance only):
{{pp-meta|reason=test|action=edit|level=autoconfirmed|category=no}}
Daughter templates (optional)
You may create simple wrappers that prefill parameters, for example:
Template:PP-vandalism
<includeonly>{{pp-meta|vandalism|action={{{ action|edit}}}|level={{{level|autoconfirmed}}}|expiry={{{expiry|indef}}}|small={{{small|}}}|date={{{date|}}}}}</includeonly> <noinclude>Wrapper for vandalism protection. [[Category:Protection templates]]</noinclude>
Template:PP-dispute
<includeonly>{{pp-meta|dispute|action={{{ action|edit}}}|level={{{level|extendedconfirmed}}}|expiry={{{expiry|}}}|small={{{small|}}}|date={{{date|}}}}}</includeonly> <noinclude>Wrapper for dispute-driven protection. [[Category:Protection templates]]</noinclude>
Configuration
Site-wide configuration lives in Module:Protection banner/config:
- images: per-action, per-level icon filenames
- protectionLevels: phrases used in banner text
- categories: mapping from action/level to category names
Update that file to adjust look, wording, and categories globally.
Limitations
- Declarative only; does not read MediaWiki protection state
- Age and date strings are displayed as provided; no automatic date parsing
- Minimal CSS. For consistent styling, add optional CSS in MediaWiki:Common.css for .cc-mbox and .cc-padlock