[ticket/492] Use B3P controller helper for loading module language
B3P-492
This commit is contained in:
@@ -26,6 +26,9 @@ class portal_module
|
|||||||
/** @var \board3\portal\portal\modules\constraints_handler */
|
/** @var \board3\portal\portal\modules\constraints_handler */
|
||||||
protected $modules_constraints;
|
protected $modules_constraints;
|
||||||
|
|
||||||
|
/** @var \board3\portal\controller\helper */
|
||||||
|
protected $board3_controller_helper;
|
||||||
|
|
||||||
/** @var int Board3 module enabled */
|
/** @var int Board3 module enabled */
|
||||||
const B3_MODULE_ENABLED = 1;
|
const B3_MODULE_ENABLED = 1;
|
||||||
|
|
||||||
@@ -55,6 +58,7 @@ class portal_module
|
|||||||
$this->portal_columns = $this->phpbb_container->get('board3.portal.columns');
|
$this->portal_columns = $this->phpbb_container->get('board3.portal.columns');
|
||||||
$this->modules_manager = $this->phpbb_container->get('board3.portal.modules.manager');
|
$this->modules_manager = $this->phpbb_container->get('board3.portal.modules.manager');
|
||||||
$this->modules_constraints = $this->phpbb_container->get('board3.portal.modules.constraints_handler');
|
$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'))
|
if (!defined('PORTAL_MODULES_TABLE'))
|
||||||
{
|
{
|
||||||
@@ -126,10 +130,9 @@ class portal_module
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->c_class->get_language())
|
// Load module language
|
||||||
{
|
$this->board3_controller_helper->load_module_language($this->c_class);
|
||||||
$this->user->add_lang_ext('board3/portal', 'modules/' . $this->c_class->get_language());
|
|
||||||
}
|
|
||||||
$module_name = $this->user->lang[$this->c_class->get_name()];
|
$module_name = $this->user->lang[$this->c_class->get_name()];
|
||||||
$display_vars = $this->c_class->get_template_acp($module_id);
|
$display_vars = $this->c_class->get_template_acp($module_id);
|
||||||
$this->template->assign_vars(array(
|
$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_allowed_columns() & $this->portal_columns->string_to_constant($add_module))
|
||||||
{
|
{
|
||||||
if ($module->get_language())
|
// Load module language
|
||||||
{
|
$this->board3_controller_helper->load_module_language($module);
|
||||||
$this->user->add_lang_ext('board3/portal', 'modules/' . $module->get_language());
|
|
||||||
}
|
|
||||||
$fileinfo[] = array(
|
$fileinfo[] = array(
|
||||||
'module' => $module_class,
|
'module' => $module_class,
|
||||||
'name' => $this->user->lang[$module->get_name()],
|
'name' => $this->user->lang[$module->get_name()],
|
||||||
@@ -605,10 +607,9 @@ class portal_module
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->c_class->get_language())
|
// Load module language
|
||||||
{
|
$this->board3_controller_helper->load_module_language($this->c_class);
|
||||||
$this->user->add_lang_ext('board3/portal', 'modules/' . $this->c_class->get_language());
|
|
||||||
}
|
|
||||||
$template_column = $this->portal_columns->number_to_string($row['module_column']);
|
$template_column = $this->portal_columns->number_to_string($row['module_column']);
|
||||||
|
|
||||||
// find out of we can move modules to the left or right
|
// 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);
|
$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.manager', $this->modules_manager);
|
||||||
$phpbb_container->set('board3.portal.modules.constraints_handler', $this->constraints_handler);
|
$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->portal_module = new \board3\portal\acp\portal_module();
|
||||||
$this->update_portal_modules();
|
$this->update_portal_modules();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user