Module:Protection banner: Difference between revisions
allow default args to work in sandbox pages
(allow reading wrapper templates and default arguments from the config page) |
(allow default args to work in sandbox pages) |
||
Line 827: | Line 827: | ||
getArgs = getArgs or require('Module:Arguments').getArgs | getArgs = getArgs or require('Module:Arguments').getArgs | ||
cfg = cfg or require('Module:Protection banner/config') | cfg = cfg or require('Module:Protection banner/config') | ||
local | local parentTitle = frame:getParent():getTitle() | ||
parentTitle = parentTitle:gsub('/sandbox$', '') | |||
local defaultArgs = cfg.wrappers[parentTitle] or {} | |||
local args = getArgs(frame, {parentOnly = defaultArgs and true}) | local args = getArgs(frame, {parentOnly = defaultArgs and true}) | ||
for k, v in pairs(defaultArgs | for k, v in pairs(defaultArgs) do | ||
args[k] = v | args[k] = v | ||
end | end |