diff options
| author | Nathaniel Guse <nathaniel.guse@gmail.com> | 2013-07-04 10:12:09 -0500 |
|---|---|---|
| committer | Nathaniel Guse <nathaniel.guse@gmail.com> | 2013-07-04 10:12:09 -0500 |
| commit | 36f25ea09bd42de7bc705332edc5ce3c402bd844 (patch) | |
| tree | a33f37e895704ed27983b53f5d16cfc3876cf057 /phpBB/includes/template/twig | |
| parent | f1717412f3c222af5c3cfc0b248842ea9ec88c9f (diff) | |
| download | forums-36f25ea09bd42de7bc705332edc5ce3c402bd844.tar forums-36f25ea09bd42de7bc705332edc5ce3c402bd844.tar.gz forums-36f25ea09bd42de7bc705332edc5ce3c402bd844.tar.bz2 forums-36f25ea09bd42de7bc705332edc5ce3c402bd844.tar.xz forums-36f25ea09bd42de7bc705332edc5ce3c402bd844.zip | |
[feature/twig] Change style->set_style to accept a list of base directories
set_style now accepts an array containing a list of paths, e.g. array(
'ext/foo/bar/styles', 'styles'). Default: array('styles')
Using this option allows us to set the style based on the user's preferred
style (including the full tree), but use one or more base directories to
add the paths from.
The main use for this ability is so that extensions can call set_style,
including their path and the phpBB styles path (or any others) and have
their template files loaded from those directories (in the order given).
PHPBB3-11598
Diffstat (limited to 'phpBB/includes/template/twig')
| -rw-r--r-- | phpBB/includes/template/twig/twig.php | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/phpBB/includes/template/twig/twig.php b/phpBB/includes/template/twig/twig.php index 98bd1ab89c..dd2c1a4023 100644 --- a/phpBB/includes/template/twig/twig.php +++ b/phpBB/includes/template/twig/twig.php @@ -181,9 +181,11 @@ class phpbb_template_twig implements phpbb_template * * @param array $style_names List of style names in inheritance tree order * @param array $style_paths List of style paths in inheritance tree order + * @param bool $is_core True if the style names are the "core" styles for this page load + * Core means the main phpBB template files * @return phpbb_template $this */ - public function set_style_names(array $style_names, array $style_paths = array()) + public function set_style_names(array $style_names, array $style_paths, $is_core = false) { $this->style_names = $style_names; @@ -191,7 +193,7 @@ class phpbb_template_twig implements phpbb_template $this->twig->getLoader()->setPaths($style_paths); // Core style namespace from phpbb_style::set_style() - if (isset($this->user->style['style_path']) && ($style_names === array($this->user->style['style_path']) || $style_names[0] == $this->user->style['style_path'])) + if ($is_core) { $this->twig->getLoader()->setPaths($style_paths, 'core'); } |
