Ok, here is the fixed up version of CreateHeader():
Code:
function GridLayout:CreateHeader(isPetGroup)
NUM_HEADERS = NUM_HEADERS + 1
local template = isPetGroup and "SecureGroupPetHeaderTemplate" or "SecureGroupHeaderTemplate"
if ClickCastHeader then
template = template .. ", ClickCastUnitTemplate"
end
local header = CreateFrame("Frame", "GridLayoutHeader" .. NUM_HEADERS, GridLayoutFrame, template)
for k, v in pairs(self.prototype) do
header[k] = v
end
header:SetAttribute("template", "SecureUnitButtonTemplate")
-- Fix for bug on the Blizz end when using SecureActionButtonTemplate with SecureGroupPetHeaderTemplate
if isPetGroup then
header:SetAttribute("useOwnerUnit", true)
header:SetAttribute("unitsuffix", "pet")
end
...
And then you have to catch any cases where a layout tries to set the useOwnerUnit attribute in GridLayout:LoadLayout():
Code:
...
-- apply defaults
if defaults then
for attr, value in pairs(defaults) do
if attr == "unitsPerColumn" then
layoutGroup:SetAttribute("unitsPerColumn", value)
layoutGroup:SetAttribute("columnSpacing", p.Padding)
layoutGroup:SetAttribute("columnAnchorPoint", getColumnAnchorPoint(p.groupAnchor, p.horizontal))
elseif attr == "useOwnerUnit" then -- related to fix for using SecureActionButtonTemplate, see GridLayout:CreateHeader()
if value == true then
layoutGroup:SetAttribute("unitsuffix", nil)
-- else do nothing or you will break things!
end
else
layoutGroup:SetAttribute(attr, value)
end
end
end
-- apply settings
for attr, value in pairs(l) do
if attr == "unitsPerColumn" then
layoutGroup:SetAttribute("unitsPerColumn", value)
layoutGroup:SetAttribute("columnSpacing", p.Padding)
layoutGroup:SetAttribute("columnAnchorPoint", getColumnAnchorPoint(p.groupAnchor, p.horizontal))
elseif attr == "useOwnerUnit" then -- related to fix for using SecureActionButtonTemplate, see GridLayout:CreateHeader()
if value == true then
layoutGroup:SetAttribute("unitsuffix", nil)
-- else do nothing or you will break things!
end
elseif attr ~= "isPetGroup" then
layoutGroup:SetAttribute(attr, value)
end
end
...