From d699ef0e3b69a1fac56abd67e7e8c9a9e5e69f6c Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Mon, 27 Apr 2015 16:18:04 +0200 Subject: [PATCH] [ticket/528] Correctly load module language for 3rd party modules B3P-528 --- config/services.yml | 1 + portal/modules/manager.php | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/config/services.yml b/config/services.yml index df0d08a4..ceaacaa1 100644 --- a/config/services.yml +++ b/config/services.yml @@ -103,6 +103,7 @@ services: arguments: - @cache - @dbal.conn + - @board3.portal.controller_helper - @board3.portal.columns - @board3.portal.helper - @board3.portal.modules.constraints_handler diff --git a/portal/modules/manager.php b/portal/modules/manager.php index aff87999..eefd9642 100644 --- a/portal/modules/manager.php +++ b/portal/modules/manager.php @@ -20,6 +20,9 @@ class manager /** @var \phpbb\cache\service */ protected $cache; + /** @var \board3\portal\controller\helper */ + protected $controller_helper; + /** @var \board3\portal\portal\columns */ protected $portal_columns; @@ -55,6 +58,7 @@ class manager * * @param \phpbb\cache\service $cache phpBB cache * @param \phpbb\db\driver\driver_interface $db Database driver + * @param \board3\portal\controller\helper $controller_helper Board3 Portal controller helper * @param \board3\portal\portal\columns $portal_columns Portal columns helper * @param \board3\portal\includes\helper $portal_helper Portal helper * @param \board3\portal\portal\modules\constraints_handler $constraints_handler Modules constraints handler @@ -62,10 +66,11 @@ class manager * @param \phpbb\request\request_interface $request phpBB request * @param \phpbb\user $user phpBB user */ - public function __construct($cache, driver_interface $db, columns $portal_columns, helper $portal_helper, constraints_handler $constraints_handler, database_handler $database_handler, request_interface $request, $user) + public function __construct($cache, driver_interface $db, \board3\portal\controller\helper $controller_helper, columns $portal_columns, helper $portal_helper, constraints_handler $constraints_handler, database_handler $database_handler, request_interface $request, $user) { $this->cache = $cache; $this->db = $db; + $this->controller_helper = $controller_helper; $this->portal_columns = $portal_columns; $this->portal_helper = $portal_helper; $this->constraints_handler = $constraints_handler; @@ -362,7 +367,7 @@ class manager { if ($this->module->get_language()) { - $this->user->add_lang_ext('board3/portal', 'modules/' . $this->module->get_language()); + $this->controller_helper->load_module_language($this->module); } $confirm_text = (isset($this->user->lang[$module_data['module_name']])) ? sprintf($this->user->lang['DELETE_MODULE_CONFIRM'], $this->user->lang[$module_data['module_name']]) : sprintf($this->user->lang['DELETE_MODULE_CONFIRM'], utf8_normalize_nfc($module_data['module_name'])); confirm_box(false, $confirm_text, build_hidden_fields(array(