conditionally hide Fees drop down item
authorBrienne Kordis <brienne@megaphonetech.com>
Tue, 6 Dec 2022 19:24:02 +0000 (14:24 -0500)
committerBrienne Kordis <brienne@megaphonetech.com>
Tue, 6 Dec 2022 19:24:02 +0000 (14:24 -0500)
CRM/Event/Page/ManageEvent.php

index 57a620ec1b90bb297fc99c401045b81cb317ade4..fc1a6f878470c651bd7c6926d4a6ff524ac75472 100644 (file)
@@ -147,13 +147,20 @@ class CRM_Event_Page_ManageEvent extends CRM_Core_Page {
           'url' => 'civicrm/event/manage/location',
           'field' => 'loc_block_id',
         ];
+      // Check to see if CiviContribute is an enabled component.
+      $components = \Civi\Api4\Setting::get()
+        ->addSelect('enable_components')
+        ->execute()[0]['value'];
+      // If CiviContribute is active, create the Fees dropdown menu item.
+      if (in_array('CiviContribute', $components)) {
+        self::$_tabLinks[$cacheKey]['fee']
+          = [
+            'title' => ts('Fees'),
+            'url' => 'civicrm/event/manage/fee',
+            'field' => 'is_monetary',
+          ];
+      }
 
-      self::$_tabLinks[$cacheKey]['fee']
-        = [
-          'title' => ts('Fees'),
-          'url' => 'civicrm/event/manage/fee',
-          'field' => 'is_monetary',
-        ];
       self::$_tabLinks[$cacheKey]['registration']
         = [
           'title' => ts('Online Registration'),