Jump to content

Module:Protection banner: Difference between revisions

just pass the args through to the /config functions - that means the /config functions can use arbitrary parameters without them having to be specified in the main module
(don't use the wrapper option with Module:Arguments, as it prevents us from passing through parameters from the parent frame)
(just pass the args through to the /config functions - that means the /config functions can use arbitrary parameters without them having to be specified in the main module)
Line 344: Line 344:
self._cfg = cfg
self._cfg = cfg
self._protectionObj = protectionObj
self._protectionObj = protectionObj
self._data = {
self._args = args
username = args.user,
section = args.section
}
end
end


Line 592: Line 589:
mw.site.namespaces[self._protectionObj.title.namespace].talk.name,
mw.site.namespaces[self._protectionObj.title.namespace].talk.name,
self._protectionObj.title.text,
self._protectionObj.title.text,
self._data.section or 'top',
self._args.section or 'top',
self:_getExpandedMessage('talk-page-link-display')
self:_getExpandedMessage('talk-page-link-display')
)
)
Line 607: Line 604:
function Blurb:_makeVandalTemplateParameter()
function Blurb:_makeVandalTemplateParameter()
return require('Module:Vandal-m')._main{
return require('Module:Vandal-m')._main{
self._data.username or self._protectionObj.title.baseText
self._args.user or self._protectionObj.title.baseText
}
}
end
end
Line 627: Line 624:
return self:_substituteParameters(msg)
return self:_substituteParameters(msg)
elseif type(msg) == 'function' then
elseif type(msg) == 'function' then
msg = msg(self._protectionObj, self._data)
msg = msg(self._protectionObj, self._args)
if type(msg) ~= 'string' then
if type(msg) ~= 'string' then
error(string.format(
error(string.format(
Cookies help us deliver our services. By using our services, you agree to our use of cookies.