Module:Protection banner: Difference between revisions

Jump to navigation Jump to search
use a __tostring metamethod to render the banner objects
(move the category methods to the Protection class, and get rid of all the category objects)
(use a __tostring metamethod to render the banner objects)
Line 794:
:caption(self._imageCaption)
:render()
end
 
function BannerTemplate:render()
-- Dummy method, to be implemented by the subclasses.
return ''
end
 
Line 820 ⟶ 815:
end
 
function Banner:rendersetPage(pages)
-- The page parameterThis specifies the page to generate the banner for,. forThis only affects
-- Module:Message box if the page specified is not the current page.
self._page = s
end
 
function Banner:__tostring()
-- Renders the banner.
-- The page parameter specifies the page to generate the banner for, for
-- testing purposes.
mMessageBox = mMessageBox or require('Module:Message box')
local reasonText = self._reasonText or error('no reason text set')
local explanationText = self._explanationText
local mbargs = {
page = pageself._page,
type = 'protection',
image = self:renderImage(),
Line 863 ⟶ 862:
end
 
function Padlock:render__tostring()
local root = mw.html.create('div')
root
Line 921 ⟶ 920:
end
 
-- Set the text fields and the page name.
if not isPadlock then
bannerObj:setReasonText(blurbObj:makeReasonText())
bannerObj:setExplanationText(blurbObj:makeExplanationText())
bannerObj:setPage(titleObj.prefixedText)
end
 
ret[#ret + 1] = bannerObj:rendertostring(bannerObj)
end
Cookies help us deliver our services. By using our services, you agree to our use of cookies.

Navigation menu