▶️
Planeshift.
The documentation for this module can be found at Template:Team icon.
You may be forwarded to another wiki language, in case a translation is not available.
Dependencies
local cargo = mw.ext.cargo
local getArgs = require( 'Module:Arguments' ).getArgs
local p = {}
function p.main( frame )
local args = getArgs(frame, {
wrappers = {
'Template:Team icon'
}
})
return p._main( args )
end
function p._main( args )
if args[1] then
local name = args[1]
local size = args[2] or '40px'
local icon = 'File:Team icon Default.png'
local cargo_output = cargo.query( 'professional_teams', 'icon, name', { where='_pageName="' .. args[1] .. '"', groupBy='_pageID' } )[1]
if cargo_output and cargo_output['icon'] ~= '' then
name = cargo_output['name']
icon = 'File:' .. cargo_output['icon']
else
local success, result = pcall( function( file ) return mw.title.new( file ).fileExists end, 'File:Team icon ' .. args[1] .. '.png' )
if success == true and result == true then
icon = 'File:Team icon ' .. args[1] .. '.png'
end
end
return '[[' .. icon .. '|' .. size .. '|link=' .. args[1] .. '|' .. name .. ']]'
else
return error( 'Check your input', 0 )
end
end
return p