From 300d5c32db82a72309d389860864e5513ca45ce4 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Tue, 13 May 2014 23:22:54 +0200 Subject: [ticket/12509] Add an option to set the path of custom file for extensions https://tracker.phpbb.com/browse/PHPBB3-12509 PHPBB3-12509 --- phpBB/phpbb/template/twig/twig.php | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'phpBB/phpbb/template') diff --git a/phpBB/phpbb/template/twig/twig.php b/phpBB/phpbb/template/twig/twig.php index 83630f5992..9e5a572cb5 100644 --- a/phpBB/phpbb/template/twig/twig.php +++ b/phpBB/phpbb/template/twig/twig.php @@ -211,8 +211,8 @@ class twig extends \phpbb\template\base * * Note: Templates are still compiled to phpBB's cache directory. * - * @param string|array $names Array of names or string of name of template(s) in inheritance tree order, used by extensions. - * @param string|array or string $paths Array of style paths, relative to current root directory + * @param string|array $names Array of names (or detailed names) or string of name of template(s) in inheritance tree order, used by extensions. + * @param string|array of string $paths Array of style paths, relative to current root directory * @return phpbb_template $this */ public function set_custom_style($names, $paths) @@ -234,10 +234,18 @@ class twig extends \phpbb\template\base $namespace = str_replace('/', '_', $ext_namespace); $paths = array(); - foreach ($names as $style_name) + foreach ($names as $template_dir) { - $ext_style_path = $ext_path . 'styles/' . $style_name . '/'; - $ext_style_template_path = $ext_style_path . 'template/'; + if (is_array($template_dir) && isset($template_dir['ext_path'])) + { + $ext_style_template_path = $ext_path . $template_dir['ext_path']; + $ext_style_path = dirname($ext_style_template_path); + } + else + { + $ext_style_path = $ext_path . 'styles/' . $template_dir . '/'; + $ext_style_template_path = $ext_style_path . 'template/'; + } if (is_dir($ext_style_template_path)) { -- cgit v1.2.1 From 1e427fa031eea8dd6a1e04f1407f996d1d948203 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Tue, 13 May 2014 23:39:42 +0200 Subject: [ticket/12509] Fix the call to set_custom_file in adm/index and messenger PHPBB3-12509 --- phpBB/phpbb/template/twig/twig.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'phpBB/phpbb/template') diff --git a/phpBB/phpbb/template/twig/twig.php b/phpBB/phpbb/template/twig/twig.php index 9e5a572cb5..a084245918 100644 --- a/phpBB/phpbb/template/twig/twig.php +++ b/phpBB/phpbb/template/twig/twig.php @@ -236,10 +236,18 @@ class twig extends \phpbb\template\base foreach ($names as $template_dir) { - if (is_array($template_dir) && isset($template_dir['ext_path'])) + if (is_array($template_dir)) { - $ext_style_template_path = $ext_path . $template_dir['ext_path']; - $ext_style_path = dirname($ext_style_template_path); + if (isset($template_dir['ext_path'])) + { + $ext_style_template_path = $ext_path . $template_dir['ext_path']; + $ext_style_path = dirname($ext_style_template_path); + } + else + { + $ext_style_path = $ext_path . 'styles/' . $template_dir['name'] . '/'; + $ext_style_template_path = $ext_style_path . 'template/'; + } } else { -- cgit v1.2.1 From 9fc2063d8623149ec6f8e359c87d626fcc5eeb88 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Tue, 13 May 2014 23:49:21 +0200 Subject: [ticket/12509] Fix doc block PHPBB3-12509 --- phpBB/phpbb/template/twig/twig.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb/template') diff --git a/phpBB/phpbb/template/twig/twig.php b/phpBB/phpbb/template/twig/twig.php index a084245918..fc6e9eacd8 100644 --- a/phpBB/phpbb/template/twig/twig.php +++ b/phpBB/phpbb/template/twig/twig.php @@ -213,7 +213,7 @@ class twig extends \phpbb\template\base * * @param string|array $names Array of names (or detailed names) or string of name of template(s) in inheritance tree order, used by extensions. * @param string|array of string $paths Array of style paths, relative to current root directory - * @return phpbb_template $this + * @return \phpbb\template\template $this */ public function set_custom_style($names, $paths) { -- cgit v1.2.1 From 05cd25a88b551d7338596cc6634e95cb371f565d Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Tue, 27 May 2014 00:05:12 +0200 Subject: [ticket/12509] Add example in doc block PHPBB3-12509 --- phpBB/phpbb/template/twig/twig.php | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'phpBB/phpbb/template') diff --git a/phpBB/phpbb/template/twig/twig.php b/phpBB/phpbb/template/twig/twig.php index fc6e9eacd8..9ea5121553 100644 --- a/phpBB/phpbb/template/twig/twig.php +++ b/phpBB/phpbb/template/twig/twig.php @@ -212,6 +212,10 @@ class twig extends \phpbb\template\base * Note: Templates are still compiled to phpBB's cache directory. * * @param string|array $names Array of names (or detailed names) or string of name of template(s) in inheritance tree order, used by extensions. + * E.g. array( + * 'name' => 'adm', + * 'ext_path' => 'adm/style/', + * ) * @param string|array of string $paths Array of style paths, relative to current root directory * @return \phpbb\template\template $this */ -- cgit v1.2.1