Module:Protection banner: Difference between revisions
Content added Content deleted
Enwikipedia>Jackmcbarn (get a few other changes from the ec) |
Enwikipedia>Mr. Stradivarius (allow passing the config object into the exportToLua and exportToWiki functions) |
||
Line 10: | Line 10: | ||
-- Lazily initialise modules and objects we don't always need. |
-- Lazily initialise modules and objects we don't always need. |
||
local mArguments, mMessageBox, lang |
local mArguments, mMessageBox, lang |
||
-------------------------------------------------------------------------------- |
-------------------------------------------------------------------------------- |
||
Line 933: | Line 933: | ||
local ProtectionBanner = {} |
local ProtectionBanner = {} |
||
function ProtectionBanner.exportToWiki(frame, titleObj) |
function ProtectionBanner.exportToWiki(frame, configObj, titleObj) |
||
mArguments = mArguments or require('Module:Arguments') |
mArguments = mArguments or require('Module:Arguments') |
||
local args = mArguments.getArgs(frame) |
local args = mArguments.getArgs(frame) |
||
return ProtectionBanner.exportToLua(args, titleObj) |
return ProtectionBanner.exportToLua(args, configObj, titleObj) |
||
end |
end |
||
function ProtectionBanner.exportToLua(args, titleObj) |
function ProtectionBanner.exportToLua(args, configObj, titleObj) |
||
⚫ | |||
titleObj = titleObj or mw.title.getCurrentTitle() |
titleObj = titleObj or mw.title.getCurrentTitle() |
||
-- |
-- Initialise protection and blurb objects |
||
if not config then |
|||
⚫ | |||
end |
|||
local configObj = config |
|||
local protectionObj = Protection:new(args, configObj, titleObj) |
local protectionObj = Protection:new(args, configObj, titleObj) |
||
-- Initialise the blurb object |
|||
local blurbObj = Blurb:new(configObj, protectionObj, titleObj) |
local blurbObj = Blurb:new(configObj, protectionObj, titleObj) |
||
blurbObj:setDeletionDiscussionPage(args.xfd) |
blurbObj:setDeletionDiscussionPage(args.xfd) |