Not logged in
Talk
Contributions
Log in
Navigation
Main page
Recent changes
Random page
Upload file
Module
Discussion
Edit
View history
Editing
Module:Message box/doc
From Body Communication
Jump to:
navigation
,
search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Used in system}} {{module rating|p}} {{Lua|Module:Message box/configuration|Module:No globals|Module:Yesno|Module:Arguments|Module:Category handler}} 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. == Usage == To use this module from another Lua module, first you need to load it. <syntaxhighlight lang="lua"> 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. <syntaxhighlight lang="lua"> local box = messageBox.main( boxType, { param1 = param1, param2 = param2, -- More parameters... }) </syntaxhighlight> There are seven available box types: {| class="wikitable" ! Box type !! Template !! Purpose |- | <code>mbox</code> || {{tl|mbox}} || For message boxes to be used in multiple namespaces |- | <code>ambox</code> || {{tl|ambox}} || For article message boxes |- | <code>cmbox</code> || {{tl|cmbox}} || For category message boxes |- | <code>fmbox</code> || {{tl|fmbox}} || For interface message boxes |- | <code>imbox</code> || {{tl|imbox}} || For file namespace message boxes |- | <code>tmbox</code> || {{tl|tmbox}} || For talk page message boxes |- | <code>ombox</code> || {{tl|ombox}} || For message boxes in other namespaces |} See the template page of each box type for the available parameters. == Usage from #invoke == As well as the <code>main</code> function, this module has separate functions for each box type. They are accessed using the code <code><nowiki>{{#invoke:Message box|mbox|...}}</nowiki></code>, <code><nowiki>{{#invoke:Message box|ambox|...}}</nowiki></code>, etc. These will work when called from other modules, but they access code used to process arguments passed from #invoke, and so calling them will be less efficient than calling <code>main</code>. == Technical details == 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> β a table containing data used by the type parameter of the message box. The table keys are the values that can be passed to the type parameter, and the table values are tables containing the class and the image used by that type. * <code>default</code> β the type to use if no value was passed to the type parameter, or if an invalid value was specified. * <code>showInvalidTypeError</code> β whether to show an error if the value passed to the type parameter was invalid. * <code>allowBlankParams</code> β usually blank values are stripped from parameters passed to the module. However, whitespace is preserved for the parameters included in the allowBlankParams table. * <code>allowSmall</code> β whether a small version of the message box can be produced with "small=yes". * <code>smallParam</code> β a custom name for the small parameter. For example, if set to "left" you can produce a small message box using "small=left". * <code>smallClass</code> β the class to use for small message boxes. * <code>substCheck</code> β whether to perform a subst check or not. * <code>classes</code> β an array of classes to use with the message box. * <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>imageEmptyCellStyle</code> β whether empty image cells should be styled. * <code>imageCheckBlank</code> β whether "image=blank" results in no image being displayed. * <code>imageSmallSize</code> β usually, images used in small message boxes are set to 30x30px. This sets a custom size. * <code>imageCellDiv</code> β whether to enclose the image in a div enforcing a maximum image size. * <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>sectionDefault</code> β the default name for the "section" parameter. Depends on <code>useCollapsibleTextFields</code>. * <code>allowMainspaceCategories</code> β allow categorisation in the main namespace. * <code>templateCategory</code> β the name of a category to be placed on the template page. * <code>templateCategoryRequireName</code> β whether the <code>name</code> parameter is required to display the template category. * <code>templateErrorCategory</code> β the name of the error category to be used on the template page. * <code>templateErrorParamsToCheck</code> β an array of parameter names to check. If any are absent, the <code>templateErrorCategory</code> is applied to the template page.
Summary:
Please note that all contributions to Body Communication are considered to be released under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License (see
Body Communication:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Templates used on this page:
Template:FULLBASEPAGENAME
(
view source
)
Template:Lua
(
view source
)
Template:Module other
(
view source
)
Template:Module rating
(
view source
)
Template:Ns has subpages
(
view source
)
Template:Ombox
(
view source
)
Template:Sandbox other
(
view source
)
Template:Tag
(
view source
)
Template:Template link
(
view source
)
Template:Tl
(
view source
)
Template:Used in system
(
view source
)
Module:Arguments
(
edit
)
Module:Effective protection level
(
edit
)
Module:High-use
(
edit
)
Module:List
(
edit
)
Module:Lua banner
(
edit
)
Module:Message box
(
edit
)
Module:Message box/configuration
(
edit
)
Module:No globals
(
edit
)
Module:Ns has subpages
(
edit
)
Module:String
(
edit
)
Module:TableTools
(
edit
)
Module:Transclusion count
(
edit
)
Module:Transclusion count/data/M
(
edit
)
Module:Yesno
(
edit
)
Tools
What links here
Related changes
Special pages
Page information