From 4bdde017187ff8e27ea0cd2119b06cc2e18c881f Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Sun, 1 Jan 2023 15:46:56 +1300 Subject: [PATCH] Update Smarty addTemplateDir function signature to future smarty --- CRM/Core/Smarty.php | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/CRM/Core/Smarty.php b/CRM/Core/Smarty.php index 483ef374ba..6cdab80b61 100644 --- a/CRM/Core/Smarty.php +++ b/CRM/Core/Smarty.php @@ -283,16 +283,26 @@ class CRM_Core_Smarty extends Smarty { } /** - * @param $path + * Add template directory(s). + * + * @param string|array $template_dir directory(s) of template sources + * @param string $key (Smarty3+) of the array element to assign the template dir to + * @param bool $isConfig (Smarty3+) true for config_dir + * + * @return Smarty current Smarty instance for chaining */ - public function addTemplateDir($path) { + public function addTemplateDir($template_dir, $key = NULL, $isConfig = FALSE) { + if (method_exists('parent', 'addTemplateDir')) { + // More recent versions of Smarty have this method. + return parent::addTemplateDir($template_dir, $key, $isConfig); + } if (is_array($this->template_dir)) { - array_unshift($this->template_dir, $path); + array_unshift($this->template_dir, $template_dir); } else { - $this->template_dir = [$path, $this->template_dir]; + $this->template_dir = [$template_dir, $this->template_dir]; } - + return $this; } /** -- 2.25.1