diff options
| author | Simon Wisselink <wisskid@users.noreply.github.com> | 2024-05-29 15:32:47 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-29 15:32:47 +0200 |
| commit | 2a87c65994811a1eb26a59f58ecbf663445e8739 (patch) | |
| tree | 6636c14411902e19515de1e2b455eb968944e34c /src | |
| parent | cdee97d3f1dff597be8583625adb42710da2c885 (diff) | |
| download | smarty-2a87c65994811a1eb26a59f58ecbf663445e8739.tar.gz smarty-2a87c65994811a1eb26a59f58ecbf663445e8739.tar.bz2 smarty-2a87c65994811a1eb26a59f58ecbf663445e8739.zip | |
implemented and documented prependTemplateDir. (#1025)
Diffstat (limited to 'src')
| -rw-r--r-- | src/Smarty.php | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/Smarty.php b/src/Smarty.php index 5af9c9b3..4f1bf425 100644 --- a/src/Smarty.php +++ b/src/Smarty.php @@ -685,6 +685,21 @@ class Smarty extends \Smarty\TemplateBase { } /** + * Adds a template directory before any existing directoires + * + * @param string $new_template_dir directory of template sources + * @param bool $is_config true for config_dir + * + * @return static current Smarty instance for chaining + */ + public function prependTemplateDir($new_template_dir, $is_config = false) { + $current_template_dirs = $is_config ? $this->config_dir : $this->template_dir; + array_unshift($current_template_dirs, $new_template_dir); + $this->setTemplateDir($current_template_dirs, $is_config); + return $this; + } + + /** * Add config directory(s) * * @param string|array $config_dir directory(s) of config sources |
