Skip to content

Commit

Permalink
Merge pull request #25248 from eileenmcnaughton/add_template
Browse files Browse the repository at this point in the history
Update Smarty addTemplateDir function signature to future smarty
  • Loading branch information
seamuslee001 authored Feb 23, 2023
2 parents f83da84 + 4bdde01 commit 6d5d6c5
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions CRM/Core/Smarty.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand Down

0 comments on commit 6d5d6c5

Please sign in to comment.