This is the documentation page for Module:Infobox
Module:Infobox is the DRUID-style layout engine that turns the simple parameters of an infobox template (such as {{ItemInfobox}} or {{NPCInfobox}}) into a full, tabbed, styled infobox.
Overview
This module builds the boxes you see in the top corner of item, weapon, armour and boss/NPC pages. It is the local copy of the "DRUID" infobox framework: a generic system that takes a list of sections, a list of data fields inside each section, and an optional set of tabs (e.g. the Tiered / Untiered / Shiny tabs on item pages), and outputs the HTML/CSS the wiki's styles and gadgets know how to display.
Editors almost never call this module directly. Instead they fill in a friendly wrapper template:
{{ItemInfobox}}— weapons, abilities and armour. Its source contains the long Script error: The function "main ..." does not exist. call with all the section/field plumbing already wired up.{{NPCInfobox}}— bosses and NPCs ({{BossInfobox}}is a redirect to it).
Those wrapper templates do all the work of mapping a handful of human-friendly parameters (title, images, Desc, Stats, Drop, etc.) onto the many low-level parameters this module expects. If you only want to document an item or a boss, edit the page that uses the wrapper template — you should not need to touch this module.
The module also tags every page that uses it with (used for maintenance and for loading the interactive tab/worn-toggle gadget).
Functions / entry points
| Function (#invoke) | What it does | Called by |
|---|---|---|
p.main |
The main entry point. Reads all parameters, splits the sections/fields/tabs, assigns the infobox a unique id, optionally sets the page's main image, and renders the whole infobox. Returns the infobox plus the tracking category. | {{ItemInfobox}}, {{NPCInfobox}}
|
p.arraymap |
A Lua re-implementation of Page Forms' #arraymap: splits argument 1 on a separator, substitutes each piece into a pattern, and re-joins. A general utility; not the main rendering path. |
(helper; available for templates that need arraymap behaviour) |
p.preprocess |
Expands (preprocesses) the wikitext passed as its first argument. A small utility for templates that need to force expansion of a value. | (helper) |
Everything else in the module is internal (the h.* helper functions): splitting argument lists, building each section, handling tabs, choosing
vs markup, escaping CSS class names, and so on. These are not #invoke entry points.
How it's used
The wrapper template holds the real call. For example, {{ItemInfobox}} contains (abbreviated):
{{#invoke:Infobox|main
|kind=item
|class=item-infobox
|sep=;
|images=... (built from the template's |images= parameter)
|tabs=... (the tab labels, e.g. Tiered / Untiered)
|sections=Description;Stats;Abilities;Reskins;Info
|Description=Unholy;Voidbound;Bloodshot;Royal;...;Desc
|Stats=Type;Attack;Defense;...;Range;Velocity
|Abilities=Ability;SP
|Reskins=ReskinList
|Info=Drop;TP;Classes
...
}}
Key concepts visible there:
|sep=; — the separator used to split lists (this infobox uses a semicolon instead of the default comma, because field values themselves contain commas).
|sections=... — the ordered list of sections to render.
|<Section>=field1;field2;... — the data fields that belong to each section.
|<field>_label=, |<field>_nolabel=true, etc. — per-field display options.
|tabs= / |<tab>_<field>= — values that differ per tab.
Ordinary editors should not write Script error: The function "..." does not exist. by hand. Put item or boss data into {{ItemInfobox}} / {{NPCInfobox}} and let those templates call this module.
Notes
- Automatic Shiny tab. If an infobox has exactly one image whose file name starts with
Ut- (the untiered-item naming scheme, e.g. Ut-Onyxblade.png) and a matching File:ShinyUt-...png exists on the wiki, the module automatically adds a second image and a "Shiny" tab (labels become Untiered / Shiny). This is why untiered items get a Shiny toggle without any extra parameters.
- Automatic Worn variant. For any image
File:Name.ext, if a File:NameWorn.ext exists, the module adds a "Show Worn" toggle button so armour can show its worn-on-character sprite.
- Main image. Unless
|setmainimage=no, the first image is registered as the page's main image (used for social/share previews) via #setmainimage; this fails silently if the wiki lacks that parser function.
- div vs table. By default the module emits
-based markup (USE_DIVS = true at the top of the file). This can be overridden globally in the module or per-infobox with |useDivs=yes/no.
- Unique ids. Each infobox on a page gets an incrementing
DRUID_INFOBOX_ID (via the Variables extension if present, otherwise a fallback) so multiple infoboxes and their tabs don't collide.
- Optional hooks. If
Module:Infobox/Hooks exists, its functions are called at defined points (onCastArgsStart/End, onMakeOutputStart/End) to let a wiki customise behaviour without editing this module.
- Related:
{{ItemInfobox}}, {{NPCInfobox}}/{{BossInfobox}}, and the per-item display modules {{Equipment}}m and {{Shinies}}m (which collect {{ItemInfobox}} blocks from category templates), and {{Reskins}}m (which feeds reskin data into {{ItemInfobox}}).