Module:Protection banner/sandbox: Difference between revisions

Content deleted Content added
Jackmcbarn (talk | contribs)
rename walkHierarchy and explain more clearly what it does
Jackmcbarn (talk | contribs)
rm unnecessary setters
Line 747:
end
return setmetatable(obj, BannerTemplate)
end
 
function BannerTemplate:setImageWidth(width)
self._imageWidth = width
end
 
function BannerTemplate:setImageTooltip(tooltip)
self._imageCaption = tooltip
end
 
Line 763 ⟶ 755:
return makeFileLink{
file = filename,
size = (self._imageWidthimageWidth or 20) .. 'px',
alt = self._imageAlt,
link = self._imageLink,
caption = self._imageCaptionimageCaption
}
end
Line 779 ⟶ 771:
function Banner.new(protectionObj, blurbObj, cfg)
local obj = BannerTemplate.new(protectionObj, cfg) -- This doesn't need the blurb.
obj:setImageWidth(.imageWidth = 40)
obj:setImageTooltip(.imageCaption = blurbObj:makeBannerText('alt')) -- Large banners use the alt text for the tooltip.
obj._reasonText = blurbObj:makeBannerText('text')
obj._explanationText = blurbObj:makeBannerText('explanation')