Module:ItemData: Difference between revisionsGive feedback
Jump to navigation
Jump to search
Add get_builds_into functions to lookup which items use the current item as a component (reverses the Components array). |
Fix get_builds_into to expand {{ItemIcon}} templates internally using expandTemplate so they render correctly inside #if conditionals instead of showing raw wikitext. |
||
| Line 506: | Line 506: | ||
-- Template: {{#invoke:ItemData|get_builds_into|ITEM_NAME}} | -- Template: {{#invoke:ItemData|get_builds_into|ITEM_NAME}} | ||
-- Returns | -- Returns fully rendered ItemIcon templates | ||
p.get_builds_into = function(frame) | p.get_builds_into = function(frame) | ||
local item = frame.args[1] | local item = frame.args[1] | ||
| Line 515: | Line 515: | ||
for _, key in ipairs(parents) do | for _, key in ipairs(parents) do | ||
local name = data[key] and data[key]["Name"] or key | local name = data[key] and data[key]["Name"] or key | ||
local icon = mw.getCurrentFrame():expandTemplate{ title = "ItemIcon", args = { name } } | |||
table.insert(parts, icon) | |||
end | end | ||