diff --git a/civiquickbooks.civix.php b/civiquickbooks.civix.php
index fbbc739..7e7015d 100644
--- a/civiquickbooks.civix.php
+++ b/civiquickbooks.civix.php
@@ -99,11 +99,6 @@ function _civiquickbooks_civix_civicrm_config($config = NULL) {
$configured = TRUE;
$extRoot = __DIR__ . DIRECTORY_SEPARATOR;
- $extDir = $extRoot . 'templates';
- if (file_exists($extDir)) {
- CRM_Core_Smarty::singleton()->addTemplateDir($extDir);
- }
-
$include_path = $extRoot . PATH_SEPARATOR . get_include_path();
set_include_path($include_path);
_civiquickbooks_civix_mixin_polyfill();
@@ -145,8 +140,8 @@ function _civiquickbooks_civix_insert_navigation_menu(&$menu, $path, $item) {
if (empty($path)) {
$menu[] = [
'attributes' => array_merge([
- 'label' => CRM_Utils_Array::value('name', $item),
- 'active' => 1,
+ 'label' => $item['name'] ?? NULL,
+ 'active' => 1,
], $item),
];
return TRUE;
@@ -210,14 +205,3 @@ function _civiquickbooks_civix_fixNavigationMenuItems(&$nodes, &$maxNavID, $pare
}
}
}
-
-/**
- * (Delegated) Implements hook_civicrm_entityTypes().
- *
- * Find any *.entityType.php files, merge their content, and return.
- *
- * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_entityTypes
- */
-function _civiquickbooks_civix_civicrm_entityTypes(&$entityTypes) {
- $entityTypes = array_merge($entityTypes, []);
-}
diff --git a/civiquickbooks.php b/civiquickbooks.php
index ff781b4..be9e7b7 100644
--- a/civiquickbooks.php
+++ b/civiquickbooks.php
@@ -270,12 +270,3 @@ function civiquickbooks_civicrm_pageRun(&$page) {
]);
}
}
-
-/**
- * Implements hook_civicrm_entityTypes().
- *
- * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_entityTypes
- */
-function civiquickbooks_civicrm_entityTypes(&$entityTypes) {
- _civiquickbooks_civix_civicrm_entityTypes($entityTypes);
-}
diff --git a/info.xml b/info.xml
index 02c078e..593a5ae 100644
--- a/info.xml
+++ b/info.xml
@@ -26,15 +26,17 @@
Development and support for this Extension is funded solely by Agileware and CiviCRM community contributions. Agileware does not receive any funding at all for this Extension from the CiviCRM Partner program or CiviCRM LLC. Agileware welcome any funding to help continue paying Agileware staff to continue contributing to the CiviCRM community and Extensions. You can donate to Agileware using https://www.paypal.me/agileware
CRM/Civiquickbooks
- 22.12.1
+ 23.02.1
menu-xml@1.0.0
mgd-php@1.0.0
setting-php@1.0.0
+ smarty-v2@1.0.1
+
CRM_Civiquickbooks_Upgrader
diff --git a/mixin/smarty-v2@1.0.1.mixin.php b/mixin/smarty-v2@1.0.1.mixin.php
new file mode 100644
index 0000000..5972dbd
--- /dev/null
+++ b/mixin/smarty-v2@1.0.1.mixin.php
@@ -0,0 +1,51 @@
+getPath('templates');
+ if (!file_exists($dir)) {
+ return;
+ }
+
+ $register = function() use ($dir) {
+ // This implementation has a theoretical edge-case bug on older versions of CiviCRM where a template could
+ // be registered more than once.
+ CRM_Core_Smarty::singleton()->addTemplateDir($dir);
+ };
+
+ // Let's figure out what environment we're in -- so that we know the best way to call $register().
+
+ if (!empty($GLOBALS['_CIVIX_MIXIN_POLYFILL'])) {
+ // Polyfill Loader (v<=5.45): We're already in the middle of firing `hook_config`.
+ if ($mixInfo->isActive()) {
+ $register();
+ }
+ return;
+ }
+
+ if (CRM_Extension_System::singleton()->getManager()->extensionIsBeingInstalledOrEnabled($mixInfo->longName)) {
+ // New Install, Standard Loader: The extension has just been enabled, and we're now setting it up.
+ // System has already booted. New templates may be needed for upcoming installation steps.
+ $register();
+ return;
+ }
+
+ // Typical Pageview, Standard Loader: Defer the actual registration for a moment -- to ensure that Smarty is online.
+ \Civi::dispatcher()->addListener('hook_civicrm_config', function() use ($mixInfo, $register) {
+ if ($mixInfo->isActive()) {
+ $register();
+ }
+ });
+
+};