aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--phpBB/config/profilefields.yml4
-rw-r--r--phpBB/phpbb/profilefields/profilefields.php28
2 files changed, 23 insertions, 9 deletions
diff --git a/phpBB/config/profilefields.yml b/phpBB/config/profilefields.yml
index 95242fe10c..efc41707df 100644
--- a/phpBB/config/profilefields.yml
+++ b/phpBB/config/profilefields.yml
@@ -4,11 +4,11 @@ services:
arguments:
- @auth
- @dbal.conn
- - @service_container
- #- @profilefields.type_collection
- @request
- @template
- @user
+ calls:
+ - [set_type_collection, [@profilefields.type_collection]]
profilefields.lang_helper:
class: \phpbb\profilefields\lang_helper
diff --git a/phpBB/phpbb/profilefields/profilefields.php b/phpBB/phpbb/profilefields/profilefields.php
index 0ed63223f5..38b8600b7b 100644
--- a/phpBB/phpbb/profilefields/profilefields.php
+++ b/phpBB/phpbb/profilefields/profilefields.php
@@ -21,17 +21,30 @@ class profilefields
/**
*
*/
- public function __construct($auth, $db, /** @todo: */ $phpbb_container, $request, $template, $user)
+ public function __construct($auth, $db, $request, $template, $user)
{
$this->auth = $auth;
$this->db = $db;
- $this->container = $phpbb_container;
$this->request = $request;
$this->template = $template;
$this->user = $user;
}
/**
+ * Setter for the type collection
+ *
+ * We need to set the type collection later,
+ * in order to avoid a circular dependency
+ *
+ * @param \phpbb\di\service_collection $type_collection
+ * @return null
+ */
+ public function set_type_collection(\phpbb\di\service_collection $type_collection)
+ {
+ $this->type_collection = $type_collection;
+ }
+
+ /**
* Assign editable fields to template, mode can be profile (for profile change) or register (for registration)
* Called by ucp_profile and ucp_register
*/
@@ -69,9 +82,10 @@ class profilefields
while ($row = $this->db->sql_fetchrow($result))
{
+
// Return templated field
$tpl_snippet = $this->process_field_row('change', $row);
- $profile_field = $this->container->get('profilefields.type.' . $this->profile_types[$row['field_type']]);
+ $profile_field = $this->type_collection['profilefields.type.' . $this->profile_types[$row['field_type']]];
$this->template->assign_block_vars('profile_fields', array(
'LANG_NAME' => $row['lang_name'],
@@ -146,7 +160,7 @@ class profilefields
while ($row = $this->db->sql_fetchrow($result))
{
- $profile_field = $this->container->get('profilefields.type.' . $this->profile_types[$row['field_type']]);
+ $profile_field = $this->type_collection['profilefields.type.' . $this->profile_types[$row['field_type']]];
$cp_data['pf_' . $row['field_ident']] = $profile_field->get_profile_field($row);
$check_value = $cp_data['pf_' . $row['field_ident']];
@@ -286,7 +300,7 @@ class profilefields
foreach ($profile_row as $ident => $ident_ary)
{
- $profile_field = $this->container->get('profilefields.type.' . $this->profile_types[$row['field_type']]);
+ $profile_field = $this->type_collection['profilefields.type.' . $this->profile_types[$row['field_type']]];
$value = $profile_field->get_profile_value($ident_ary['value'], $ident_ary['data']);
if ($value === NULL)
@@ -341,7 +355,7 @@ class profilefields
}
// Assign template variables
- $profile_field = $this->container->get('profilefields.type.' . $this->profile_types[$profile_row['field_type']]);
+ $profile_field = $this->type_collection['profilefields.type.' . $this->profile_types[$profile_row['field_type']]];
$profile_field->generate_field($profile_row, $preview_options);
// Return templated data
@@ -368,7 +382,7 @@ class profilefields
while ($row = $this->db->sql_fetchrow($result))
{
- $profile_field = $this->container->get('profilefields.type.' . $this->profile_types[$row['field_type']]);
+ $profile_field = $this->type_collection['profilefields.type.' . $this->profile_types[$row['field_type']]];
$cp_data['pf_' . $row['field_ident']] = $profile_field->get_default_field_value($row);
}
$this->db->sql_freeresult($result);