Anonymous user
Module:Protection banner: Difference between revisions
condense _main and switch Blurb arg order
Enwikipedia>Jackmcbarn (rm some locals that only get used once) |
Enwikipedia>Jackmcbarn (condense _main and switch Blurb arg order) |
||
Line 339:
local Blurb = class('Blurb')
function Blurb:initialize(
self._cfg = cfg
self._protectionObj = protectionObj
Line 894:
-- Initialise protection and blurb objects
local protectionObj = Protection:new(args, cfg)
local blurbObj = Blurb:new(
blurbObj:setDeletionDiscussionPage(args.xfd)
blurbObj:setUsername(args.user)
Line 904:
if protectionObj:isProtected() then
-- Get the banner object
local bannerObj
if
bannerObj = Padlock:new(cfg)
bannerObj = Banner:new(cfg)▼
-- Set the image fields▼
local bannerConfig = protectionObj.bannerConfig▼
bannerObj:setImageFilename(bannerConfig.image, protectionObj)▼
bannerObj:setImageTooltip(blurbObj:makeTooltipText())
bannerObj:setImageAlt(blurbObj:makeAltText())
bannerObj:setImageLink(blurbObj:makeLinkText())
else
▲ bannerObj = Banner:new(cfg)
-- Large banners use the alt text for the tooltip.
bannerObj:setImageTooltip(blurbObj:makeAltText())
-- Set the text fields and the page name.▼
▲ -- Set the text fields and the page name.
bannerObj:setReasonText(blurbObj:makeReasonText())
bannerObj:setExplanationText(blurbObj:makeExplanationText())
bannerObj:setPage(protectionObj.title.prefixedText)
end
▲ -- Set the image fields
▲ local bannerConfig = protectionObj.bannerConfig
▲ bannerObj:setImageFilename(bannerConfig.image, protectionObj)
ret[#ret + 1] = tostring(bannerObj)
|