aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--phpBB/phpbb/profilefields/profilefields.php10
-rw-r--r--phpBB/phpbb/profilefields/type/type_bool.php8
-rw-r--r--phpBB/phpbb/profilefields/type/type_date.php8
-rw-r--r--phpBB/phpbb/profilefields/type/type_dropdown.php8
-rw-r--r--phpBB/phpbb/profilefields/type/type_int.php8
-rw-r--r--phpBB/phpbb/profilefields/type/type_interface.php11
-rw-r--r--phpBB/phpbb/profilefields/type/type_string_common.php8
7 files changed, 55 insertions, 6 deletions
diff --git a/phpBB/phpbb/profilefields/profilefields.php b/phpBB/phpbb/profilefields/profilefields.php
index 78b408ba56..e01611460b 100644
--- a/phpBB/phpbb/profilefields/profilefields.php
+++ b/phpBB/phpbb/profilefields/profilefields.php
@@ -72,17 +72,15 @@ class profilefields
{
// Return templated field
$tpl_snippet = $this->process_field_row('change', $row);
-
- // Some types are multivalue, we can't give them a field_id as we would not know which to pick
- $type = (int) $row['field_type'];
+ $profile_field = $this->container->get('profilefields.type.' . $this->profile_types[$row['field_type']]);
$this->template->assign_block_vars('profile_fields', array(
'LANG_NAME' => $row['lang_name'],
'LANG_EXPLAIN' => $row['lang_explain'],
'FIELD' => $tpl_snippet,
- 'FIELD_ID' => ($type == FIELD_DATE || ($type == FIELD_BOOL && $row['field_length'] == '1')) ? '' : 'pf_' . $row['field_ident'],
- 'S_REQUIRED' => ($row['field_required']) ? true : false)
- );
+ 'FIELD_ID' => $profile_field->get_field_ident($row),
+ 'S_REQUIRED' => ($row['field_required']) ? true : false,
+ ));
}
$this->db->sql_freeresult($result);
}
diff --git a/phpBB/phpbb/profilefields/type/type_bool.php b/phpBB/phpbb/profilefields/type/type_bool.php
index e60806becd..f4b056d3fc 100644
--- a/phpBB/phpbb/profilefields/type/type_bool.php
+++ b/phpBB/phpbb/profilefields/type/type_bool.php
@@ -176,4 +176,12 @@ class type_bool implements type_interface
}
}
}
+
+ /**
+ * {@inheritDoc}
+ */
+ public function get_field_ident($field_data)
+ {
+ return ($field_data['field_length'] == '1') ? '' : 'pf_' . $field_data['field_ident'];
+ }
}
diff --git a/phpBB/phpbb/profilefields/type/type_date.php b/phpBB/phpbb/profilefields/type/type_date.php
index 7aabafcb14..21b55874e5 100644
--- a/phpBB/phpbb/profilefields/type/type_date.php
+++ b/phpBB/phpbb/profilefields/type/type_date.php
@@ -224,4 +224,12 @@ class type_date implements type_interface
$profile_row['field_value'] = 0;
$this->template->assign_block_vars('date', array_change_key_case($profile_row, CASE_UPPER));
}
+
+ /**
+ * {@inheritDoc}
+ */
+ public function get_field_ident($field_data)
+ {
+ return '';
+ }
}
diff --git a/phpBB/phpbb/profilefields/type/type_dropdown.php b/phpBB/phpbb/profilefields/type/type_dropdown.php
index c461815426..9b434fd085 100644
--- a/phpBB/phpbb/profilefields/type/type_dropdown.php
+++ b/phpBB/phpbb/profilefields/type/type_dropdown.php
@@ -173,4 +173,12 @@ class type_dropdown implements type_interface
);
}
}
+
+ /**
+ * {@inheritDoc}
+ */
+ public function get_field_ident($field_data)
+ {
+ return 'pf_' . $field_data['field_ident'];
+ }
}
diff --git a/phpBB/phpbb/profilefields/type/type_int.php b/phpBB/phpbb/profilefields/type/type_int.php
index f650436d21..7ac99f5b80 100644
--- a/phpBB/phpbb/profilefields/type/type_int.php
+++ b/phpBB/phpbb/profilefields/type/type_int.php
@@ -150,4 +150,12 @@ class type_int implements type_interface
$this->template->assign_block_vars('int', array_change_key_case($profile_row, CASE_UPPER));
}
+
+ /**
+ * {@inheritDoc}
+ */
+ public function get_field_ident($field_data)
+ {
+ return 'pf_' . $field_data['field_ident'];
+ }
}
diff --git a/phpBB/phpbb/profilefields/type/type_interface.php b/phpBB/phpbb/profilefields/type/type_interface.php
index d53c038d2d..9c78e1956d 100644
--- a/phpBB/phpbb/profilefields/type/type_interface.php
+++ b/phpBB/phpbb/profilefields/type/type_interface.php
@@ -79,4 +79,15 @@ interface type_interface
* @return null
*/
public function generate_field($profile_row, $preview = false);
+
+ /**
+ * Get the ident of the field
+ *
+ * Some types are multivalue, we can't give them a field_id
+ * as we would not know which to pick.
+ *
+ * @param array $field_data Array with data for this field
+ * @return string ident of the field
+ */
+ public function get_field_ident($field_data);
}
diff --git a/phpBB/phpbb/profilefields/type/type_string_common.php b/phpBB/phpbb/profilefields/type/type_string_common.php
index 02b640bb44..686c50d4db 100644
--- a/phpBB/phpbb/profilefields/type/type_string_common.php
+++ b/phpBB/phpbb/profilefields/type/type_string_common.php
@@ -101,4 +101,12 @@ abstract class type_string_common
$field_value = bbcode_nl2br($field_value);
return $field_value;
}
+
+ /**
+ * {@inheritDoc}
+ */
+ public function get_field_ident($field_data)
+ {
+ return 'pf_' . $field_data['field_ident'];
+ }
}