Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core: Add support for passing header attributes as a table #685

Merged
merged 1 commit into from
Jul 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
ls- marked this conversation as resolved.
Show resolved Hide resolved
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