Module:Protection banner: Difference between revisions
add an image link parameter, and get the link data from the banner config
(only make link text if the link message is available) |
(add an image link parameter, and get the link data from the banner config) |
||
Line 39: | Line 39: | ||
'tooltip', | 'tooltip', | ||
'alt', | 'alt', | ||
'link', | |||
'image' | 'image' | ||
} | } | ||
Line 246: | Line 247: | ||
parameterFuncs.EXPIRY = self._makeExpiryParameter | parameterFuncs.EXPIRY = self._makeExpiryParameter | ||
parameterFuncs.EXPLANATIONBLURB = self._makeExplanationBlurbParameter | parameterFuncs.EXPLANATIONBLURB = self._makeExplanationBlurbParameter | ||
parameterFuncs.IMAGELINK = self._makeImageLinkParameter | |||
parameterFuncs.INTROBLURB = self._makeIntroBlurbParameter | parameterFuncs.INTROBLURB = self._makeIntroBlurbParameter | ||
parameterFuncs.OFFICEBLURB = self._makeOfficeBlurbParameter | parameterFuncs.OFFICEBLURB = self._makeOfficeBlurbParameter | ||
Line 391: | Line 393: | ||
end | end | ||
return self:_getExpandedMessage(key) | return self:_getExpandedMessage(key) | ||
end | |||
function Blurb:_makeImageLinkParameter() | |||
local imageLinks = self._configObj:getConfigTable('imageLinks') | |||
local action = self._protectionObj:getAction() | |||
local level = self._protectionObj:getLevel() | |||
local msg | |||
if imageLinks[action][level] then | |||
msg = imageLinks[action][level] | |||
elseif imageLinks[action].default then | |||
msg = imageLinks[action].default | |||
else | |||
msg = imageLinks.edit.default | |||
end | |||
return self:_substituteParameters(msg) | |||
end | end | ||
Line 533: | Line 550: | ||
function Blurb:makeReasonText() | function Blurb:makeReasonText() | ||
local msg = self._bannerConfig.text | local msg = self._bannerConfig.text | ||
return self:_substituteParameters(msg) | if msg then | ||
return self:_substituteParameters(msg) | |||
end | |||
end | end | ||
Line 553: | Line 572: | ||
function Blurb:makeLinkText() | function Blurb:makeLinkText() | ||
local msg = self._bannerConfig.link | local msg = self._bannerConfig.link | ||
return self:_substituteParameters(msg) | |||
end | end | ||