Module:Message box/doc: Difference between revisions

m
1 revision imported from wikipedia:Module:Message_box/doc: w
m (1 revision imported)
 
m (1 revision imported from wikipedia:Module:Message_box/doc: w)
 
(2 intermediate revisions by 2 users not shown)
Line 1:
{{Used in system}}
{{High-risk|4,450,000+}}
{{module rating|p}}
{{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 ⟶ 10:
To use this module from another Lua module, first you need to load it.
 
<sourcesyntaxhighlight lang="lua">
local messageBox = require('Module:Message box')
</syntaxhighlight>
</source>
 
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.
 
<sourcesyntaxhighlight lang="lua">
local box = messageBox.main( boxType, {
param1 = param1,
Line 20 ⟶ 22:
-- More parameters...
})
</syntaxhighlight>
</source>
 
There are seven available box types:
Line 52 ⟶ 54:
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>usePlainlinksParam</code> - whether to allow "plainlinks=no" to turn off the plainlinks class.
* <code>imageEmptyCellStyle</code> – whether empty image cells should be styled.
* <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>imageEmptyCellStyleimageCheckBlank</code> - whether empty "image=blank" cellsresults shouldin no image bebeing styleddisplayed.
* <code>imageCheckBlankimageSmallSize</code> - whetherusually, "image=blank"images resultsused in nosmall imagemessage beingboxes displayedare set to 30x30px. This sets a custom size.
* <code>imageSmallSizeimageCellDiv</code> - usually,whether imagesto usedenclose inthe smallimage messagein boxesa arediv setenforcing toa 30x30px. This sets amaximum customimage size.
* <code>imageCellDivuseCollapsibleTextFields</code> - whether to encloseuse thetext imagefields inthat acan divbe enforcingcollapsed, ai.e. maximum"issue", image"fix", "talk", etc. Currently only used in sizeambox.
* <code>useCollapsibleTextFieldsimageRightNone</code> - whether toimageright=none useresults textin fieldsno thatimage canbeing bedisplayed collapsed,on i.e.the "issue",right-hand "fix",side "talk",of etc.the Currently only used inmessage amboxbox.
* <code>sectionDefault</code> - the default name for the "section" parameter. Depends on <code>useCollapsibleTextFields</code>.
* <code>imageRightNone</code> - whether imageright=none results in no image being displayed on the right-hand side of the message box.
* <code>allowMainspaceCategories</code> – allow categorisation in the main namespace.
* <code>sectionDefault</code> - the default name for the "section" parameter. Depends on <code>useCollapsibleTextFields</code>.
* <code>allowMainspaceCategoriestemplateCategory</code> - allowthe name of a category to be categorisationplaced inon the maintemplate namespacepage.
* <code>templateCategorytemplateCategoryRequireName</code> -– whether the <code>name</code> ofparameter ais categoryrequired to be placed ondisplay the template pagecategory.
* <code>templateCategoryRequireNametemplateErrorCategory</code> - whether the <code>name</code> parameterof isthe requirederror category to displaybe used on the template categorypage.
* <code>templateErrorCategorytemplateErrorParamsToCheck</code> - thean namearray of theparameter error categorynames to becheck. usedIf onany are absent, the <code>templateErrorCategory</code> is applied to 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.