Module:T-Campaign: Difference between revisions
// via Wikitext Extension for VSCode |
// via Wikitext Extension for VSCode |
||
| Line 61: | Line 61: | ||
-- Custom preprocessor to load campaign data and generate fields dynamically | -- Custom preprocessor to load campaign data and generate fields dynamically | ||
Blueprint.addPreprocessor(template, function(template, args) | Blueprint.addPreprocessor(template, function(template, args) | ||
-- Get campaign_name from args (which should already be merged by Blueprint) | |||
-- But also check the current frame for direct module invocations | |||
local campaignName = args.campaign_name | local campaignName = args.campaign_name | ||
-- If not found in args, try to get it from the current frame | |||
if (not campaignName or campaignName == "") and template.current_frame then | |||
local frameArgs = template.current_frame.args or {} | |||
campaignName = frameArgs.campaign_name | |||
end | |||
if not campaignName or campaignName == "" then | if not campaignName or campaignName == "" then | ||
ErrorHandling.addError( | ErrorHandling.addError( | ||