Module:WikiProjectBanner/Note

MyWikiBiz, Author Your Legacy — Sunday December 22, 2024
Jump to navigationJump to search

Documentation for this module may be created at Module:WikiProjectBanner/Note/doc

-------------------------------------------------------------------------------
--                               Note class                                  --
-- This module contains the Note class used in Module:WikiProjectBanner. It  --
-- is used to generate the requests and notices rows.                        --
-------------------------------------------------------------------------------
 
local Row = require('Module:WikiProjectBanner/Row')

local Note = setmetatable({}, Row)
Note.__index = Note

function Note.new(args, bannerData, cfg, rowCfg)
	local obj = Row.new(args, bannerData, cfg, rowCfg)
	setmetatable(obj, Note)

	-- Text
	if rowCfg.image then
		obj:setIcon(string.format(
				'[[File:%s|x25px|center|alt=Note icon]]',
				rowCfg.image
		))
	end
	obj:setText(rowCfg.text)

	-- Categories
	obj:addCategory(rowCfg.category)

	return obj
end

return Note