From 96c6b93f6855b078c05a23dddd08b68f81279ead Mon Sep 17 00:00:00 2001 From: colemanw Date: Fri, 11 Nov 2022 15:21:41 -0500 Subject: [PATCH] Simplify hook_civicrm_config, remove extension from include_path Since #265 the `include_path` addition has not been needed except for odd edge-cases where the extension has stuff that's not covered by the autoloader. I'm honestly not sure what those things might be, but best-practice is to use the autoloader and not mess with `include_path`. --- .../Resources/views/Code/module.civix.php.php | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/src/CRM/CivixBundle/Resources/views/Code/module.civix.php.php b/src/CRM/CivixBundle/Resources/views/Code/module.civix.php.php index a860c162..73e554da 100644 --- a/src/CRM/CivixBundle/Resources/views/Code/module.civix.php.php +++ b/src/CRM/CivixBundle/Resources/views/Code/module.civix.php.php @@ -105,20 +105,13 @@ function __civix_civicrm_config(&$config = NULL) { } $configured = TRUE; - $template = CRM_Core_Smarty::singleton(); + $tplDir = __DIR__ . DIRECTORY_SEPARATOR . 'templates'; - $extRoot = __DIR__ . DIRECTORY_SEPARATOR; - $extDir = $extRoot . 'templates'; - - if (is_array($template->template_dir)) { - array_unshift($template->template_dir, $extDir); - } - else { - $template->template_dir = [$extDir, $template->template_dir]; + if (is_dir($tplDir)) { + $smarty = CRM_Core_Smarty::singleton(); + $smarty->template_dir = array_merge([$tplDir], (array) $smarty->template_dir); } - $include_path = $extRoot . PATH_SEPARATOR . get_include_path(); - set_include_path($include_path); }