Skip to content

Commit

Permalink
feat: add clan tag to clash of clans infobox team (#4117)
Browse files Browse the repository at this point in the history
* create infobox_team_custom

* Update infobox_team_custom.lua

Co-authored-by: hjpalpha <[email protected]>

* Update components/infobox/wikis/clashofclans/infobox_team_custom.lua

Co-authored-by: mbergen <[email protected]>

---------

Co-authored-by: hjpalpha <[email protected]>
Co-authored-by: mbergen <[email protected]>
  • Loading branch information
3 people authored Mar 26, 2024
1 parent 6542984 commit 601d2d2
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions components/infobox/wikis/clashofclans/infobox_team_custom.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
-- @Liquipedia
-- wiki=clashofclans
-- page=Module:Infobox/Team/Custom
--
-- Please see https://github.com/Liquipedia/Lua-Modules to contribute
--

local Class = require('Module:Class')
local Lua = require('Module:Lua')

local Injector = Lua.import('Module:Infobox/Widget/Injector')
local Team = Lua.import('Module:Infobox/Team')

local Widgets = require('Module:Infobox/Widget/All')
local Cell = Widgets.Cell

---@class ClashofClansInfoboxTeam: InfoboxTeam
local CustomTeam = Class.new(Team)
local CustomInjector = Class.new(Injector)

---@param frame Frame
---@return Html
function CustomTeam.run(frame)
local team = CustomTeam(frame)
team:setWidgetInjector(CustomInjector(team))

return team:createInfobox()
end

---@param id string
---@param widgets Widget[]
---@return Widget[]
function CustomInjector:parse(id, widgets)
local args = self.caller.args

if id == 'topcustomcontent' then
table.insert(widgets, Cell{name = 'Clan Tag', content = {args.clantag}})
end
return widgets
end

return CustomTeam

0 comments on commit 601d2d2

Please sign in to comment.