Content deleted Content added
No edit summary |
64.114 etc (talk | contribs) No edit summary |
||
(83 intermediate revisions by 60 users not shown) | |||
Line 1:
{{Used in system}}
{{module rating|p}}
{{cascade-protected template|page=module}}
{{Lua|Module:Message box/configuration|Module:Yesno|Module:Arguments|Module:Category handler}}
{{Uses TemplateStyles|Module:Message box/ambox.css|Module:Message box/cmbox.css|Module:Message box/fmbox.css|Module:Message box/imbox.css|Module:Message box/ombox.css|Module:Message box/tmbox.css}}
This is a meta-module that implements the message box templates {{tl|mbox}}, {{tl|ambox}}, {{tl|cmbox}}, {{tl|fmbox}}, {{tl|imbox}}, {{tl|ombox}}, and {{tl|tmbox}}. It is intended to be used from Lua modules, and should not be used directly from wiki pages. If you want to use this module's functionality from a wiki page, please use the individual message box templates instead.
Line 8 ⟶ 11:
To use this module from another Lua module, first you need to load it.
<
local messageBox = require('Module:Message box')
</syntaxhighlight>
To create a message box, use the <code>main</code> function. It takes two parameters: the first is the box type (as a string), and the second is a table containing the message box parameters.
<
local box = messageBox.main( boxType, {
param1 = param1,
Line 20 ⟶ 23:
-- More parameters...
})
</syntaxhighlight>
There are seven available box types:
Line 52 ⟶ 55:
The module uses the same basic code for each of the templates listed above; the differences between each of them are configured using the data at [[Module:Message box/configuration]]. Here are the various configuration options and what they mean:
* <code>types</code>
* <code>default</code>
* <code>showInvalidTypeError</code>
* <code>allowBlankParams</code>
* <code>
* <code>
* <code>
* <code>
* <code>
* <code>imageEmptyCell</code>
* <code>
* <code>
▲* <code>imageEmptyCell</code> - whether to use an empty {{tag|td}} cell if there is no image set. This is used to preserve spacing for message boxes with a width of less than 100% of the screen.
* <code>imageSmallSize</code>
* <code>
* <code>useCollapsibleTextFields</code>
▲* <code>imageSmallSize</code> - usually, images used in small message boxes are set to 30x30px. This sets a custom size.
* <code>
* <code>sectionDefault</code> – the default name for the "section" parameter. Depends on <code>useCollapsibleTextFields</code>.
▲* <code>useCollapsibleTextFields</code> - whether to use text fields that can be collapsed, i.e. "issue", "fix", "talk", etc. Currently only used in ambox.
▲* <code>imageRightNone</code> - whether imageright=none results in no image being displayed on the right-hand side of the message box.
* <code>
* <code>templateCategoryRequireName</code> – whether the <code>name</code> parameter is required to display the template category.
▲* <code>allowMainspaceCategories</code> - allow categorisation in the main namespace.
* <code>
* <code>
<includeonly>{{Sandbox other||
[[Category:Wikipedia modules]]
}}</includeonly>
|