Expand all

ve.dm.MWParameterModel

Constructor

new ve.dm.MWParameterModel(template, [name], [value]) #

Represents a parameter that's part of a template invocation, centered around the parameter's value. Holds a reference to the specification of the template and the parameter as it is documented via TemplateData. Meant to be a sub-element of a {@see ve.dm.MWTemplateModel}, which is a sub-element of a {@see ve.dm.MWTransclusionModel}.

Parameters:

Name Type Attributes Default Description
template ve.dm.MWTemplateModel

Reference back to the template that contains the parameter, as well as to the specification

name string optional

Can be missing or empty when meant to be used as a placeholder. Parameters without a name won't be serialized to wikitext, {@see ve.dm.MWTemplateModel.serialize}.

value string optional
''
Mixes in:
Source:

Represents a parameter that's part of a template invocation, centered around the parameter's value.

Methods

getAutoValue() → {string} #

Source:

Returns:

Type
string

getDefaultValue() → {string} #

Source:

Returns:

Type
string

getExampleValue() → {string|null} #

Source:

Returns:

Type
string | null

getId() → {string} #

Get unique parameter ID within the transclusion.

Source:

Returns:

Unique ID

Type
string
Get unique parameter ID within the transclusion.

getName() → {string} #

Source:

Returns:

Trimmed parameter name, or an empty string if no name was provided

Type
string

getOriginalName() → {string|undefined} #

Original parameter name. Will be used in {@see ve.dm.MWTransclusionPartModel.serialize}.

Source:

Returns:

Untrimmed parameter name as provided on construction time

Type
string | undefined
Original parameter name.

getSuggestedValues() → {Array.<string>} #

Source:

Returns:

Type
Array.<string>

getTemplate() → {ve.dm.MWTemplateModel} #

Get template of which this parameter is part.

Source:

Returns:

Type
ve.dm.MWTemplateModel
Get template of which this parameter is part.

getType() → {string} #

Source:

Returns:

Parameter type, e.g. "string"

Type
string

getValue() → {string} #

Source:

Returns:

Parameter value, or automatic value if there is none stored. Otherwise an empty string.

Type
string

isDeprecated() → {boolean} #

Source:

Returns:

Type
boolean

isDocumented() → {boolean} #

Source:

Returns:

Type
boolean

isRequired() → {boolean} #

Source:

Returns:

Type
boolean

isSuggested() → {boolean} #

Source:

Returns:

Type
boolean

remove() #

Remove parameter from template.

Source:
Remove parameter from template.

setValue(value) #

Parameters:

Name Type Description
value string
Source:

Fires:

Events

change() #

Emitted when the parameter's value changed.

Source:
Emitted when the parameter's value changed.