Module:Protection banner: Difference between revisions
Content added Content deleted
Enwikipedia>Mr. Stradivarius (don't use the wrapper option with Module:Arguments, as it prevents us from passing through parameters from the parent frame) |
Enwikipedia>Mr. Stradivarius (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. |
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. |
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. |
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. |
msg = msg(self._protectionObj, self._args) |
||
if type(msg) ~= 'string' then |
if type(msg) ~= 'string' then |
||
error(string.format( |
error(string.format( |