mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
[ticket/11201] Remove remaining type depending code to type class
PHPBB3-11201
This commit is contained in:
parent
9dec023632
commit
cd6bdc7b27
7 changed files with 55 additions and 6 deletions
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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'];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 '';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -173,4 +173,12 @@ class type_dropdown implements type_interface
|
|||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function get_field_ident($field_data)
|
||||
{
|
||||
return 'pf_' . $field_data['field_ident'];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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'];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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'];
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue