diff options
author | kasimi <mail@kasimi.net> | 2017-04-28 16:32:11 +0200 |
---|---|---|
committer | kasimi <mail@kasimi.net> | 2017-04-28 16:32:11 +0200 |
commit | e6b7defd3818771d27ab2b3aa0e7d9a8448fc4e7 (patch) | |
tree | f80559ad900ba49ce24d61a1ac650543b2a49191 /phpBB/phpbb | |
parent | 725498075396461f393cd05eb710f7847683c6b9 (diff) | |
download | forums-e6b7def.tar forums-e6b7def.tar.gz forums-e6b7def.tar.bz2 forums-e6b7def.tar.xz forums-e6b7def.zip |
[ticket/15187] Add paths of newly enabled extensions to template
When enabling an extension its paths aren't added immediately to
the template which results in ACP events not being registered in
the compiled template files.
PHPBB3-15187
Diffstat (limited to 'phpBB/phpbb')
-rw-r--r-- | phpBB/phpbb/extension/manager.php | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/phpBB/phpbb/extension/manager.php b/phpBB/phpbb/extension/manager.php index e7e5f83c23..7045624f28 100644 --- a/phpBB/phpbb/extension/manager.php +++ b/phpBB/phpbb/extension/manager.php @@ -227,6 +227,8 @@ class manager if ($active) { $this->config->increment('assets_version', 1); + + $this->update_template_paths($name, $this->container->get('template')); } return !$active; @@ -589,4 +591,38 @@ class manager } return $finder; } + + /** + * Make the template aware of ACP template events of a newly enabled extension + * + * @param string $name The extension's name + * @param \phpbb\template\base|null $template The template service + * @return null + */ + protected function update_template_paths($name, \phpbb\template\base $template = null) + { + if ($template instanceof \phpbb\template\base) + { + $possible_paths = array( + $this->phpbb_root_path . 'ext/' . $name . '/adm/style', + $this->phpbb_root_path . 'ext/' . $name . '/styles', + ); + + $paths = array_filter($possible_paths, 'is_dir'); + + if ($paths) + { + $names = array( + array( + 'name' => 'adm', + 'ext_path' => 'adm/style/', + ), + ); + + $paths[] = $this->phpbb_root_path . 'adm/style'; + + $template->set_custom_style($names, $paths); + } + } + } } |