Module:Protection banner: Difference between revisions
Content added Content deleted
Enwikipedia>Mr. Stradivarius (add a blurb parameter function for making the explanation text) |
Enwikipedia>Mr. Stradivarius (allow specifying banner config by protection level as well as by action) |
||
Line 85: | Line 85: | ||
function Config:getBannerConfig(protectionStatusObj) |
function Config:getBannerConfig(protectionStatusObj) |
||
⚫ | |||
⚫ | |||
⚫ | |||
if self._bannerConfigTables[protectionStatusObj] then |
if self._bannerConfigTables[protectionStatusObj] then |
||
return self._bannerConfigTables[protectionStatusObj] |
return self._bannerConfigTables[protectionStatusObj] |
||
else |
else |
||
local ret = {} |
local ret = {} |
||
⚫ | |||
⚫ | |||
local level = protectionStatusObj:getLevel() |
|||
⚫ | |||
local fields = { |
local fields = { |
||
'text', |
'text', |
||
Line 103: | Line 103: | ||
} |
} |
||
local configTables = {} |
local configTables = {} |
||
if cfg.banners[action] then |
|||
configTables[#configTables + 1] = cfg. |
configTables[#configTables + 1] = cfg.banners[action][reason] |
||
end |
|||
if cfg.defaultBanners[action] then |
|||
configTables[#configTables + 1] = cfg.defaultBanners[action][level] |
|||
configTables[#configTables + 1] = cfg.defaultBanners[action].default |
|||
end |
|||
for i, field in ipairs(fields) do |
for i, field in ipairs(fields) do |
||
for j, t in ipairs(configTables) do |
for j, t in ipairs(configTables) do |