[ticket/12509] Add an option to set the path of custom file for extensions

https://tracker.phpbb.com/browse/PHPBB3-12509

PHPBB3-12509
This commit is contained in:
Tristan Darricau 2014-05-13 23:22:54 +02:00
parent bec9b7c34e
commit 300d5c32db
2 changed files with 17 additions and 6 deletions

View file

@ -252,7 +252,10 @@ class messenger
}
}
$this->set_template_paths($template_lang . '_email', $template_paths);
$this->set_template_paths(array(
'name' => $template_lang . '_email',
'ext_path' => 'language/' . $template_lang . '/email'
), $template_paths);
$this->template->set_filenames(array(
'body' => $template_file . '.txt',

View file

@ -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))
{