diff options
| author | Joas Schilling <nickvergessen@gmx.de> | 2014-05-28 00:23:37 +0200 |
|---|---|---|
| committer | Joas Schilling <nickvergessen@gmx.de> | 2014-05-28 00:23:37 +0200 |
| commit | 08c01b7cee629701dc62b32b03eb5543e8c9d196 (patch) | |
| tree | c5c5627c54d7a930e1cec89ea2b8a973b1b79ebf /phpBB/phpbb | |
| parent | 83fc8725daf163398300ff6ddc6256b9444b39cd (diff) | |
| parent | 05cd25a88b551d7338596cc6634e95cb371f565d (diff) | |
| download | forums-08c01b7cee629701dc62b32b03eb5543e8c9d196.tar forums-08c01b7cee629701dc62b32b03eb5543e8c9d196.tar.gz forums-08c01b7cee629701dc62b32b03eb5543e8c9d196.tar.bz2 forums-08c01b7cee629701dc62b32b03eb5543e8c9d196.tar.xz forums-08c01b7cee629701dc62b32b03eb5543e8c9d196.zip | |
Merge pull request #2455 from Nicofuma/ticket/12509
[ticket/12509] Add an option to set the path of custom style directory (ie: email templates) for extensions
* Nicofuma/ticket/12509:
[ticket/12509] Add example in doc block
[ticket/12509] Add missing ',' in arrays
[ticket/12509] Update calls to set_custom_style in forgotten places
[ticket/12509] Fix path in adm/index.php
[ticket/12509] Fix typo in adm/index.php
[ticket/12509] Fix doc block
[ticket/12509] Fix the call to set_custom_file in adm/index and messenger
[ticket/12509] Update acp custom_style setter
[ticket/12509] Add an option to set the path of custom file for extensions
Diffstat (limited to 'phpBB/phpbb')
| -rw-r--r-- | phpBB/phpbb/template/twig/twig.php | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/phpBB/phpbb/template/twig/twig.php b/phpBB/phpbb/template/twig/twig.php index 83630f5992..9ea5121553 100644 --- a/phpBB/phpbb/template/twig/twig.php +++ b/phpBB/phpbb/template/twig/twig.php @@ -211,9 +211,13 @@ 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 - * @return phpbb_template $this + * @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 */ public function set_custom_style($names, $paths) { @@ -234,10 +238,26 @@ 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)) + { + 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 + { + $ext_style_path = $ext_path . 'styles/' . $template_dir . '/'; + $ext_style_template_path = $ext_style_path . 'template/'; + } if (is_dir($ext_style_template_path)) { |
