Skip to content

Commit

Permalink
core: Add support for passing header attributes as a table
Browse files Browse the repository at this point in the history
  • Loading branch information
p3lim committed Jul 31, 2024
1 parent 73f4fde commit 9a08037
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions ouf.lua
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ do
(string?)
* visibility - macro conditional(s) which define when to display the header (string).
* ... - further argument pairs. Consult [Group Headers](https://warcraft.wiki.gg/wiki/SecureGroupHeaderTemplate)
for possible values.
for possible values. If preferred, the attributes can be an associative table.
In addition to the standard group headers, oUF implements some of its own attributes. These can be supplied by the
layout, but are optional. PingableUnitFrameTemplate is inherited for Ping support.
Expand All @@ -640,10 +640,19 @@ do
local header = CreateFrame('Frame', name, PetBattleFrameHider, template)

header:SetAttribute('template', 'SecureUnitButtonTemplate, SecureHandlerStateTemplate, SecureHandlerEnterLeaveTemplate, PingableUnitFrameTemplate')
for i = 1, select('#', ...), 2 do
local att, val = select(i, ...)
if(not att) then break end
header:SetAttribute(att, val)

if(...) then
if(type(...) == 'table') then
for att, val in next, (...) do
header:SetAttribute(att, val)
end
else
for i = 1, select('#', ...), 2 do
local att, val = select(i, ...)
if(not att) then break end
header:SetAttribute(att, val)
end
end
end

header.style = style
Expand Down

0 comments on commit 9a08037

Please sign in to comment.