Modul:Classgenerator/parameter/class/doc

ZIM HilfeWiki - das Wiki

This is a Class Module. It implements a class in Lua using Module:Middleclass and the template class Module:Foundationclass. This class provides methods for adding and editing of a class's parameters.

Usage[Quelltext bearbeiten]

local name = args[1] or args.name or mw.title.getCurrentTitle().rootText
local Class = require('Module:Name/class')
local me = Class:new(name)
me:initFromArgs(args)
me:storeData()
me:addInfobox()
me:addPageBody()
return me:render()


Data Storage

This template does not store any persistent data.

Methods[Quelltext bearbeiten]

Constructor[Quelltext bearbeiten]

new(uid)[Quelltext bearbeiten]

Creates a new Object for the class.

uid
variable, optional
used to identify the object
return
object, of the class

Public methods[Quelltext bearbeiten]

myArgumentProcessing(coreData)[Quelltext bearbeiten]

Performs the individual argument processing in initFromArgs(args) right before inititializing it.

coreData
table, mandatory
the core data of the object. the one to process individually before initialization
return
table, the new core data array to be used

myPlausibilityTest(args)[Quelltext bearbeiten]

Performs the individual plausibility tests in initFromArgs(args) before entering the initialization part. NOTE: The return value will be ignored. If this finds errors, it must add them to the list of errors via addError(errortext).

args
table, mandatory
arguments passed to the template to be checked
return
boolean, whether the object is plausible or not.

myStashAdjustments(self, stash)[Quelltext bearbeiten]

Performs the adjusts the stash in storeData() right before storing it.

stash
table, mandatory
the array of data to be saved (in the form fieldname: value)
return
boolean, the new stash

render()[Quelltext bearbeiten]

Produces the appropriate output for this parameter

return
boolean, whether adding was successful or not

static methods[Quelltext bearbeiten]

ClassgeneratorParameter:mySfDynamicFieldAttribute(fieldname, attribute, value)[Quelltext bearbeiten]

For some semantic form fields there are attribute values, that are not static, thus can not be provided at forehand in the configuration file. This method does the trick to adapt them at runtime shortly before the field is rendered. Essentially: the method checks, if it has a special rule for the pair fieldname:attribute and if so, calculates the new value. if not, the old value is returned.

fieldname
string, mandatory
the form field's name, needed to match current paring to an existing special treatment rule
attribute
string, mandatory
the form field's attribute, needed to match current paring to an existing special treatment rule
value
variable, mandatory
the value, that is already provided in the configuration file. this will be adapted by the method, if there is a special rule for the pair fieldname:attribute.
return
string, the value to be used forthwith (which can be the old one or a freshly calculated)

private methods[Quelltext bearbeiten]

_debug(self, level, text)[Quelltext bearbeiten]

Adds output to the internal debug log.

self
object, me
level
int; mandatory
debug level for the message
text
string; mandatory
debug message text
return
void

Properties[Quelltext bearbeiten]

static[Quelltext bearbeiten]

See also Static Properties

ClassgeneratorParameter.myConfiguration
this is your configuration. It is devided in several section, each a
table, holds configuration data found in Module:Name/config
WARNING: This is a read only table and besides functions pairs() and ipairs() nothing else will work on it, especially not the functions of the table library!
    • form, table, holds data used to create the form. here are some of them:
      • formButtons, table, which buttons should be printed at the bottom
      • fieldOrder, table, in which order the form fields should appear (note: only fields listed here will be added to the form)
    • global, table, holds some global configuration data
    • parameter, table, holds all data about all parameter used in the module (be they form only, data store only or normal). The table has the form paramname = { table of paramdata }. The tables for the parameter have data as follows:
      • cardinality, string, mandatory, one of singe or list
      • cargo_type, string, optional, if the parameter is to be stored in cargo, add the field type here (one of Page, Text, Integer, Float, Date, Datetime, Boolean (which should be provided as 1 or 0), Coordinates, Wikitext, File, String, URL, or Email)
      • description, string, mandatory, a description of this parameter
      • label, string, mandatory, the label used in the form and the template documentation
      • severity, string, optional, if provided one of mandatory, suggested
      • sf, table, optional, used to add more attributes to the semantic forms field. ref Module:SFfield/config for all possible attributes. Note that the table is of type attribute_name : value. Value can be of type string, integer, boolean, and (in case of 'show on select') a table. Please note, that the attribute name cannot contain a " " (space). Use the underscore instead.
      • td_default, string, optional, if you want a default value to be indicated in the template data section on the documentation page, add it here
      • td_type, string, optional, if the parameter should be present in the template documentation page, fill this field. all possible values are listed here
      • values, table, optional, if you want the possible values to be restricted to a specific set, fill this table
    • template, table, holds some data used only in the template
ClassgeneratorParameter.publicStaticProperty
type, explanation
_privateStaticProperty
type, explanation

private[Quelltext bearbeiten]

Note: all private properties are stored in table _private[self]. _private is a static array that is indexed by self, so the table _private[self] holds all properties for instance self.

dbg
object, my instance of Module:Debug/class for debugging purposes. only present afer first call of _debug(self, level, text)

Configuration Data[Quelltext bearbeiten]

This class holds its control data in Module:Classgenerator/parameter/class/config.

Inheritance[Quelltext bearbeiten]

Note: You still reference those either by self:publicMethod() or ClassgeneratorParameter:staticMethod() and ClassgeneratorParameter.staticProperty respectively!

Methods[Quelltext bearbeiten]

MediaWiki:Classengine-content-documentation-methods

Static Properties[Quelltext bearbeiten]

MediaWiki:Classengine-content-documentation-properties

Cookies helfen uns bei der Bereitstellung des ZIM HilfeWikis. Bei der Nutzung vom ZIM HilfeWiki werden die in der Datenschutzerklärung beschriebenen Cookies gespeichert.