aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVjacheslav Trushkin <arty@phpbb.com>2012-03-14 23:22:02 +0200
committerVjacheslav Trushkin <arty@phpbb.com>2012-03-14 23:22:02 +0200
commit234e5d6402978ba1a7cfbb3d163512657c7b87fc (patch)
tree0e5bdfa999f571d665e95f9e8e873a2c4f2a59cc
parentae3b0f736d45690d37a10a453a98e598166e8506 (diff)
downloadforums-234e5d6402978ba1a7cfbb3d163512657c7b87fc.tar
forums-234e5d6402978ba1a7cfbb3d163512657c7b87fc.tar.gz
forums-234e5d6402978ba1a7cfbb3d163512657c7b87fc.tar.bz2
forums-234e5d6402978ba1a7cfbb3d163512657c7b87fc.tar.xz
forums-234e5d6402978ba1a7cfbb3d163512657c7b87fc.zip
[feature/merging-style-components] Implementing unlimited parent templates
Implementing possibility of unlimited levels of parent templates. Paths are stored in style_parent_tree, entries are separated by / PHPBB3-10632
-rw-r--r--phpBB/includes/style/template.php19
1 files changed, 14 insertions, 5 deletions
diff --git a/phpBB/includes/style/template.php b/phpBB/includes/style/template.php
index a8c5139dd0..02fa0bd250 100644
--- a/phpBB/includes/style/template.php
+++ b/phpBB/includes/style/template.php
@@ -97,8 +97,8 @@ class phpbb_style_template
*/
public function set_template()
{
- $template_name = $this->user->theme['template_path'];
- $fallback_name = ($this->user->theme['template_inherits_id']) ? $this->user->theme['template_inherit_path'] : false;
+ $template_name = $this->user->theme['style_path'];
+ $fallback_name = ($this->user->theme['style_parent_id']) ? array_reverse(explode('/', $this->user->theme['style_parent_tree'])) : false;
return $this->set_custom_template(false, $template_name, false, $fallback_name);
}
@@ -121,17 +121,26 @@ class phpbb_style_template
*
* @param string $template_path Path to template directory
* @param string $template_name Name of template
- * @param string $fallback_template_path Path to fallback template
- * @param string $fallback_template_name Name of fallback template
+ * @param string or array $fallback_template_path Path to fallback template
+ * @param string or array $fallback_template_name Name of fallback template
*/
public function set_custom_template($template_path, $template_name, $fallback_template_path = false, $fallback_template_name = false)
{
$templates = array($template_name => $template_path);
- if ($fallback_template_name !== false)
+ if (is_string($fallback_template_name))
{
$templates[$fallback_template_name] = $fallback_template_path;
}
+ if (is_array($fallback_template_name))
+ {
+ $i = 0;
+ foreach ($fallback_template_name as $fallback_template_name_item)
+ {
+ $templates[$fallback_template_name_item] = is_array($fallback_template_path) ? $fallback_template_path[$i] : $fallback_template_path;
+ $i ++;
+ }
+ }
$this->provider->set_templates($templates, $this->phpbb_root_path);
$this->locator->set_paths($this->provider);