diff --git a/CRM/Event/Badge.php b/CRM/Event/Badge.php index a23d9c14c053bdfefc4500d152a1c17f224b4673..974b2a9c7638a249210b301538205bf763f408fe 100644 --- a/CRM/Event/Badge.php +++ b/CRM/Event/Badge.php @@ -100,23 +100,19 @@ class CRM_Event_Badge { $img = get_class($this) . "." . $this->imgExtension; } - $config = CRM_Core_Config::singleton(); - $imgFile = $config->customTemplateDir . "/$path/$eventID/$img"; - if (file_exists($imgFile)) { - return $imgFile; - } - $imgFile = $config->customTemplateDir . "/$path/$img"; - if (file_exists($imgFile)) { - return $imgFile; - } - - $imgFile = "$civicrm_root/templates/$path/$eventID/$img"; - if (file_exists($imgFile)) { - return $imgFile; - } - $imgFile = "$civicrm_root/templates/$path/$img"; - if (!file_exists($imgFile) && !$this->debug) { - return FALSE; + // CRM-13235 - leverage the Smarty path to get all templates directories + $template = CRM_Core_Smarty::singleton(); + if (isset($template->template_dir) && $template->template_dir) { + $dirs = is_array( $template->template_dir ) ? $template->template_dir : array($template->template_dir); + foreach ($dirs as $dir) { + foreach (array( "$dir/$path/$eventID/$img", "$dir/$path/$img") as $imgFile) { + if (file_exists($imgFile)) { + return $imgFile; + } + } + } + } else { + $imgFile = 'No template directories defined anywhere??'; } // not sure it exists, but at least will display a meaniful fatal error in debug mode