Module:TemplateHelpers: Difference between revisions

// via Wikitext Extension for VSCode
Tag: Reverted
// via Wikitext Extension for VSCode
Tag: Manual revert
Line 626: Line 626:
--  - imageParams: Additional image parameters like size, alignment (default: "")
--  - imageParams: Additional image parameters like size, alignment (default: "")
--  - errorContext: Optional error context for error handling
--  - errorContext: Optional error context for error handling
--  - markProcessed: Whether to mark the logo field as processed (default: true)
-- @return The rendered logo block HTML or empty string if no logo
-- @return The rendered logo block HTML or empty string if no logo
function p.renderLogoBlock(args, options)
function p.renderLogoBlock(args, options)
Line 633: Line 632:
     local cssClass = options.cssClass or "template-logo"
     local cssClass = options.cssClass or "template-logo"
     local imageParams = options.imageParams or ""
     local imageParams = options.imageParams or ""
    local markProcessed = options.markProcessed ~= false -- Default to true
      
      
     -- Define the logo rendering operation
     -- Define the logo rendering operation
     local function renderLogoOperation(args, cssClass, imageParams, markProcessed)
     local function renderLogoOperation(args, cssClass, imageParams)
         -- Get logo parameter
         -- Get logo parameter
         local logo = args["logo"]
         local logo = args["logo"]
Line 650: Line 648:
         -- Format image parameters if provided
         -- Format image parameters if provided
         local imgParams = imageParams ~= "" and "|" .. imageParams or ""
         local imgParams = imageParams ~= "" and "|" .. imageParams or ""
       
        -- Mark the logo field as processed by adding a special flag
        -- This will be checked in LuaTemplateBlueprint to avoid duplicating the logo in fields
        if markProcessed then
            -- Create _processedFields if it doesn't exist
            args._processedFields = args._processedFields or {}
            -- Mark logo field as processed
            args._processedFields.logo = true
        end
          
          
         -- Render the logo image
         -- Render the logo image
Line 673: Line 662:
         renderLogoOperation,
         renderLogoOperation,
         "", -- Empty string fallback
         "", -- Empty string fallback
         args, cssClass, imageParams, markProcessed
         args, cssClass, imageParams
     )
     )
end
end