Merge pull request #493 from marc1706/ticket/492
[ticket/492] Use B3P controller helper for loading module language
This commit is contained in:
@@ -26,6 +26,9 @@ class portal_module
|
||||
/** @var \board3\portal\portal\modules\constraints_handler */
|
||||
protected $modules_constraints;
|
||||
|
||||
/** @var \board3\portal\controller\helper */
|
||||
protected $board3_controller_helper;
|
||||
|
||||
/** @var int Board3 module enabled */
|
||||
const B3_MODULE_ENABLED = 1;
|
||||
|
||||
@@ -55,6 +58,7 @@ class portal_module
|
||||
$this->portal_columns = $this->phpbb_container->get('board3.portal.columns');
|
||||
$this->modules_manager = $this->phpbb_container->get('board3.portal.modules.manager');
|
||||
$this->modules_constraints = $this->phpbb_container->get('board3.portal.modules.constraints_handler');
|
||||
$this->board3_controller_helper = $this->phpbb_container->get('board3.portal.controller_helper');
|
||||
|
||||
if (!defined('PORTAL_MODULES_TABLE'))
|
||||
{
|
||||
@@ -126,10 +130,9 @@ class portal_module
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($this->c_class->get_language())
|
||||
{
|
||||
$this->user->add_lang_ext('board3/portal', 'modules/' . $this->c_class->get_language());
|
||||
}
|
||||
// Load module language
|
||||
$this->board3_controller_helper->load_module_language($this->c_class);
|
||||
|
||||
$module_name = $this->user->lang[$this->c_class->get_name()];
|
||||
$display_vars = $this->c_class->get_template_acp($module_id);
|
||||
$this->template->assign_vars(array(
|
||||
@@ -542,10 +545,9 @@ class portal_module
|
||||
|
||||
if ($module->get_allowed_columns() & $this->portal_columns->string_to_constant($add_module))
|
||||
{
|
||||
if ($module->get_language())
|
||||
{
|
||||
$this->user->add_lang_ext('board3/portal', 'modules/' . $module->get_language());
|
||||
}
|
||||
// Load module language
|
||||
$this->board3_controller_helper->load_module_language($module);
|
||||
|
||||
$fileinfo[] = array(
|
||||
'module' => $module_class,
|
||||
'name' => $this->user->lang[$module->get_name()],
|
||||
@@ -605,10 +607,9 @@ class portal_module
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($this->c_class->get_language())
|
||||
{
|
||||
$this->user->add_lang_ext('board3/portal', 'modules/' . $this->c_class->get_language());
|
||||
}
|
||||
// Load module language
|
||||
$this->board3_controller_helper->load_module_language($this->c_class);
|
||||
|
||||
$template_column = $this->portal_columns->number_to_string($row['module_column']);
|
||||
|
||||
// find out of we can move modules to the left or right
|
||||
|
||||
@@ -85,6 +85,41 @@ class phpbb_acp_move_module_test extends \board3\portal\tests\testframework\data
|
||||
$this->modules_manager = new \board3\portal\portal\modules\manager($cache, $db, $this->portal_columns, $this->portal_helper, $this->constraints_handler, $this->database_handler, $request, $user);
|
||||
$phpbb_container->set('board3.portal.modules.manager', $this->modules_manager);
|
||||
$phpbb_container->set('board3.portal.modules.constraints_handler', $this->constraints_handler);
|
||||
|
||||
$path_helper = new \phpbb\path_helper(
|
||||
new \phpbb\symfony_request(
|
||||
new \phpbb_mock_request()
|
||||
),
|
||||
new \phpbb\filesystem(),
|
||||
new \phpbb_mock_request(),
|
||||
$phpbb_root_path,
|
||||
$phpEx
|
||||
);
|
||||
|
||||
$modules = array(
|
||||
'\board3\portal\modules\clock' => new \board3\portal\modules\clock($config, $template),
|
||||
);
|
||||
$portal_helper = new \board3\portal\includes\helper($modules);
|
||||
$auth = $this->getMock('\phpbb\auth\auth', array('acl_get'));
|
||||
$auth->expects($this->any())
|
||||
->method('acl_get')
|
||||
->with($this->anything())
|
||||
->will($this->returnValue(true));
|
||||
|
||||
$controller_helper = new \board3\portal\controller\helper(
|
||||
$auth,
|
||||
$this->portal_columns,
|
||||
$config,
|
||||
$template,
|
||||
$user,
|
||||
$path_helper,
|
||||
$portal_helper,
|
||||
$phpbb_root_path,
|
||||
'.' . $phpEx
|
||||
);
|
||||
|
||||
$phpbb_container->set('board3.portal.controller_helper', $controller_helper);
|
||||
|
||||
$this->portal_module = new \board3\portal\acp\portal_module();
|
||||
$this->update_portal_modules();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user