Currently the ping system allows defining a frame to be a "ping receiver" that - if the ping hotkey is pressed while mouseovered - can trigger a contextual ping that can be redirected to a specific unit. This integration requires that a frame include PingableType_UnitFrameMixin, which will communicate the desired unit via a unit field on the frame table itself.
This however isn't too convenient for use with secure group headers that display party and raid frames; the secure header system creates frames on-demand as units come into existence and stores the unit token in a "unit" attribute, rather than as a field. Additionally, there's some more boilerplate required to apply this mixin to newly-created unit frames on-demand.
It'd be convenient for the following changes to be made:
For a new template to be added that includes PingableType_UnitFrameMixin.
Essentially these changes could just look like this:
diff --git a/Interface/SharedXML/PingAttributes.xml b/Interface/SharedXML/PingAttributes.xml
index 8e08df40..a13f5095 100644
--- a/Interface/SharedXML/PingAttributes.xml
+++ b/Interface/SharedXML/PingAttributes.xml
@@ -12,4 +12,6 @@
<Attribute name="ping-top-level-pass-through" type="boolean" value="true"/>
</Attributes>
</Frame>
+
+ <Frame name="PingableUnitFrameTemplate" mixin="PingableType_UnitFrameMixin" inherits="PingReceiverAttributeTemplate" virtual="true"/>
</Ui>
\ No newline at end of file
diff --git a/Interface/SharedXML/PingableType.lua b/Interface/SharedXML/PingableType.lua
index a0c7faed..29ad122d 100644
--- a/Interface/SharedXML/PingableType.lua
+++ b/Interface/SharedXML/PingableType.lua
@@ -19,5 +19,5 @@ function PingableType_UnitFrameMixin:GetContextualPingType()
end
function PingableType_UnitFrameMixin:GetTargetPingGUID()
- return UnitGUID(self.unit);
+ return UnitGUID(self:GetAttribute("unit") or self.unit);
end
\ No newline at end of file
With these changes addons that use secure headers won't need to manually synchronize changes made to the "unit" attribute to a field of the same name on the frame table itself, and can opt-in to being ping receivers by adding a single space-separated template name to the "template" attribute on the group header without needing to add any additional logic to apply the mixin manually.
Currently the ping system allows defining a frame to be a "ping receiver" that - if the ping hotkey is pressed while mouseovered - can trigger a contextual ping that can be redirected to a specific unit. This integration requires that a frame include PingableType_UnitFrameMixin, which will communicate the desired unit via a
unit
field on the frame table itself.This however isn't too convenient for use with secure group headers that display party and raid frames; the secure header system creates frames on-demand as units come into existence and stores the unit token in a "unit" attribute, rather than as a field. Additionally, there's some more boilerplate required to apply this mixin to newly-created unit frames on-demand.
It'd be convenient for the following changes to be made:
Essentially these changes could just look like this:
With these changes addons that use secure headers won't need to manually synchronize changes made to the "unit" attribute to a field of the same name on the frame table itself, and can opt-in to being ping receivers by adding a single space-separated template name to the "template" attribute on the group header without needing to add any additional logic to apply the mixin manually.