Merge pull request #23210 from eileenmcnaughton/cancel
[civicrm-core.git] / CRM / Core / BAO / CustomGroup.php
index c00e866270eda0c0f01bb3146d9e2276277249c1..1dfa5697e05b851d438110243a57b2c6250da4cd 100644 (file)
 /**
  * Business object for managing custom data groups.
  */
-class CRM_Core_BAO_CustomGroup extends CRM_Core_DAO_CustomGroup {
+class CRM_Core_BAO_CustomGroup extends CRM_Core_DAO_CustomGroup implements \Civi\Core\HookInterface {
+
+  /**
+   * @param \Civi\Core\Event\PostEvent $e
+   * @see CRM_Utils_Hook::post()
+   */
+  public static function self_hook_civicrm_post(\Civi\Core\Event\PostEvent $e): void {
+    Civi::cache('metadata')->flush();
+  }
 
   /**
    * Takes an associative array and creates a custom group object.
@@ -1888,7 +1896,7 @@ SELECT IF( EXISTS(SELECT name FROM civicrm_contact_type WHERE name like %1), 1,
    * @return array|int
    * @throws \CRM_Core_Exception
    */
-  public static function buildCustomDataView(&$form, $groupTree, $returnCount = FALSE, $gID = NULL, $prefix = NULL, $customValueId = NULL, $entityId = NULL, $checkEditPermission = FALSE) {
+  public static function buildCustomDataView($form, $groupTree, $returnCount = FALSE, $gID = NULL, $prefix = NULL, $customValueId = NULL, $entityId = NULL, $checkEditPermission = FALSE) {
     // Filter out pesky extra info
     unset($groupTree['info']);
 
@@ -1975,7 +1983,12 @@ SELECT IF( EXISTS(SELECT name FROM civicrm_contact_type WHERE name like %1), 1,
       }
     }
     else {
-      $form->assign_by_ref("{$prefix}viewCustomData", $details);
+      $form->addExpectedSmartyVariables([
+        'multiRecordDisplay',
+        'groupId',
+        'skipTitle',
+      ]);
+      $form->assign("{$prefix}viewCustomData", $details);
       return $details;
     }
   }
@@ -2246,7 +2259,7 @@ SELECT  civicrm_custom_group.id as groupID, civicrm_custom_group.title as groupT
     $sel2['Campaign'] = $campaignTypes;
     $sel2['Membership'] = $membershipType;
     $sel2['ParticipantRole'] = $participantRole;
-    $sel2['ParticipantEventName'] = CRM_Event_PseudoConstant::event(NULL, FALSE, "( is_template IS NULL OR is_template != 1 )");
+    $sel2['ParticipantEventName'] = CRM_Event_PseudoConstant::event(NULL, FALSE, "( is_template != 1 )");
     $sel2['ParticipantEventType'] = $eventType;
     $sel2['Contribution'] = CRM_Contribute_PseudoConstant::financialType();
     $sel2['Relationship'] = CRM_Custom_Form_Group::getRelationshipTypes();