Module:Protection banner: Difference between revisions
allow passing the config object into the exportToLua and exportToWiki functions
(get a few other changes from the ec) |
(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) | ||
configObj = configObj or mw.loadData('Module:Protection banner/config') | |||
titleObj = titleObj or mw.title.getCurrentTitle() | titleObj = titleObj or mw.title.getCurrentTitle() | ||
-- | -- Initialise protection and blurb objects | ||
local protectionObj = Protection:new(args, configObj, titleObj) | local protectionObj = Protection:new(args, configObj, titleObj) | ||
local blurbObj = Blurb:new(configObj, protectionObj, titleObj) | local blurbObj = Blurb:new(configObj, protectionObj, titleObj) | ||
blurbObj:setDeletionDiscussionPage(args.xfd) | blurbObj:setDeletionDiscussionPage(args.xfd) |