mirror of
https://github.com/phpbb/phpbb.git
synced 2025-02-24 20:13:22 +01:00
[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
This commit is contained in:
parent
ae3b0f736d
commit
234e5d6402
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user