diff --git a/CRM/Core/Smarty.php b/CRM/Core/Smarty.php index 5c0d1d884a7f..41a70205753a 100644 --- a/CRM/Core/Smarty.php +++ b/CRM/Core/Smarty.php @@ -301,16 +301,26 @@ public static function registerStringResource() { } /** - * @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; } /**