|
@@ 730-749 (lines=20) @@
|
| 727 |
|
* This retrieves the associated template pack with this message. |
| 728 |
|
* @return EE_Messages_Template_Pack | null |
| 729 |
|
*/ |
| 730 |
|
public function get_template_pack() { |
| 731 |
|
/** |
| 732 |
|
* This is deprecated functionality that will be removed eventually but included here now for backward compat. |
| 733 |
|
*/ |
| 734 |
|
if ( ! empty( $this->template_pack ) ) { |
| 735 |
|
return $this->template_pack; |
| 736 |
|
} |
| 737 |
|
/** @type EE_Message_Template_Group $grp */ |
| 738 |
|
$grp = $this->get_first_related( 'Message_Template_Group' ); |
| 739 |
|
//if no group then let's try to get the first related group by internal messenger and message type (will use global grp). |
| 740 |
|
if ( ! $grp instanceof EE_Message_Template_Group ) { |
| 741 |
|
$grp = EEM_Message_Template_Group::instance()->get_one( |
| 742 |
|
array( |
| 743 |
|
array( |
| 744 |
|
'MTP_messenger' => $this->messenger(), |
| 745 |
|
'MTP_message_type' => $this->message_type(), |
| 746 |
|
'MTP_is_global' => true |
| 747 |
|
) |
| 748 |
|
) |
| 749 |
|
); |
| 750 |
|
} |
| 751 |
|
|
| 752 |
|
return $grp instanceof EE_Message_Template_Group ? $grp->get_template_pack() : null; |
|
@@ 762-783 (lines=22) @@
|
| 759 |
|
* Retrieves the variation used for generating this message. |
| 760 |
|
* @return string |
| 761 |
|
*/ |
| 762 |
|
public function get_template_pack_variation() { |
| 763 |
|
/** |
| 764 |
|
* This is deprecated functionality that will be removed eventually but included here now for backward compat. |
| 765 |
|
*/ |
| 766 |
|
if ( ! empty( $this->template_variation ) ) { |
| 767 |
|
return $this->template_variation; |
| 768 |
|
} |
| 769 |
|
|
| 770 |
|
/** @type EE_Message_Template_Group $grp */ |
| 771 |
|
$grp = $this->get_first_related( 'Message_Template_Group' ); |
| 772 |
|
|
| 773 |
|
//if no group then let's try to get the first related group by internal messenger and message type (will use global grp). |
| 774 |
|
if ( ! $grp instanceof EE_Message_Template_Group ) { |
| 775 |
|
$grp = EEM_Message_Template_Group::instance()->get_one( |
| 776 |
|
array( |
| 777 |
|
array( |
| 778 |
|
'MTP_messenger' => $this->messenger(), |
| 779 |
|
'MTP_message_type' => $this->message_type(), |
| 780 |
|
'MTP_is_global' => true |
| 781 |
|
) |
| 782 |
|
) |
| 783 |
|
); |
| 784 |
|
} |
| 785 |
|
|
| 786 |
|
return $grp instanceof EE_Message_Template_Group ? $grp->get_template_pack_variation() : ''; |