Module:Protection banner: Difference between revisions

add a blurb parameter function for making the explanation text
(lazily initialise modules we don't always need)
(add a blurb parameter function for making the explanation text)
Line 197: Line 197:
parameterFuncs[16] = self._makeDeletionDiscussionLinkParameter
parameterFuncs[16] = self._makeDeletionDiscussionLinkParameter
parameterFuncs[17] = self._makeDeletionLogParameter
parameterFuncs[17] = self._makeDeletionLogParameter
parameterFuncs[18] = self._makeExplanationTextParameter
self._params = params
self._params = params
Line 454: Line 455:
self._configObj:getMessage('deletion-log-link-display')
self._configObj:getMessage('deletion-log-link-display')
)
)
end
function Blurb:_makeExplanationTextParameter()
-- parameter $18
local action = self._protectionStatusObj:getAction()
local level = self._protectionStatusObj:getLevel()
local key
if action == 'edit' and level == 'autoconfirmed' then
key = 'explanation-text-semi'
elseif action == 'move' then
key = 'explanation-text-move'
elseif action == 'create' then
key = 'explanation-text-create'
else
key = 'explanation-text-default'
end
local msg = self._configObj:getMessage(key)
return self:_substituteParameters(msg)
end
end