mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
[ticket/12169] Split mode==headline into it's own function
PHPBB3-12169
This commit is contained in:
parent
995019a992
commit
5550f0fa87
2 changed files with 36 additions and 29 deletions
|
@ -1508,7 +1508,7 @@ switch ($mode)
|
||||||
{
|
{
|
||||||
$cp = $phpbb_container->get('profilefields.manager');
|
$cp = $phpbb_container->get('profilefields.manager');
|
||||||
|
|
||||||
$cp_row = $cp->generate_profile_fields_template('headlines', false, false, 'field_show_on_ml');
|
$cp_row = $cp->generate_profile_fields_template_headlines('field_show_on_ml');
|
||||||
foreach ($cp_row as $profile_field)
|
foreach ($cp_row as $profile_field)
|
||||||
{
|
{
|
||||||
$template->assign_block_vars('custom_fields', $profile_field);
|
$template->assign_block_vars('custom_fields', $profile_field);
|
||||||
|
|
|
@ -242,39 +242,46 @@ class manager
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate the template arrays in order to display the column names
|
||||||
|
*
|
||||||
|
* @param string $restrict_option Restrict the published fields to a certain profile field option
|
||||||
|
* @return array Returns an array with the template variables type, name and explain for the fields to display
|
||||||
|
*/
|
||||||
|
public function generate_profile_fields_template_headlines($restrict_option = '')
|
||||||
|
{
|
||||||
|
if (!sizeof($this->profile_cache))
|
||||||
|
{
|
||||||
|
$this->build_cache();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Go through the fields in correct order
|
||||||
|
foreach ($this->profile_cache as $field_ident => $field_data)
|
||||||
|
{
|
||||||
|
if ($restrict_option && !$field_data[$restrict_option])
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$profile_field = $this->type_collection[$field_data['field_type']];
|
||||||
|
|
||||||
|
$tpl_fields[] = array(
|
||||||
|
'PROFILE_FIELD_TYPE' => $field_data['field_type'],
|
||||||
|
'PROFILE_FIELD_NAME' => $profile_field->get_field_name($field_data['lang_name']),
|
||||||
|
'PROFILE_FIELD_EXPLAIN' => $this->user->lang($field_data['lang_explain']),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $tpl_fields;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Assign fields to template, used for viewprofile, viewtopic and memberlist (if load setting is enabled)
|
* Assign fields to template, used for viewprofile, viewtopic and memberlist (if load setting is enabled)
|
||||||
* This is directly connected to the user -> mode == grab is to grab the user specific fields, mode == show is for assigning the row to the template
|
* This is directly connected to the user -> mode == grab is to grab the user specific fields, mode == show is for assigning the row to the template
|
||||||
*/
|
*/
|
||||||
public function generate_profile_fields_template($mode, $user_id = 0, $profile_row = false, $restrict_option = false)
|
public function generate_profile_fields_template($mode, $user_id = 0, $profile_row = false)
|
||||||
{
|
{
|
||||||
if ($mode == 'headlines')
|
if ($mode == 'grab')
|
||||||
{
|
|
||||||
if (!sizeof($this->profile_cache))
|
|
||||||
{
|
|
||||||
$this->build_cache();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Go through the fields in correct order
|
|
||||||
foreach ($this->profile_cache as $field_ident => $field_data)
|
|
||||||
{
|
|
||||||
if ($restrict_option && !$field_data[$restrict_option])
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$profile_field = $this->type_collection[$field_data['field_type']];
|
|
||||||
|
|
||||||
$tpl_fields[] = array(
|
|
||||||
'PROFILE_FIELD_TYPE' => $field_data['field_type'],
|
|
||||||
'PROFILE_FIELD_NAME' => $profile_field->get_field_name($field_data['lang_name']),
|
|
||||||
'PROFILE_FIELD_EXPLAIN' => $this->user->lang($field_data['lang_explain']),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $tpl_fields;
|
|
||||||
}
|
|
||||||
else if ($mode == 'grab')
|
|
||||||
{
|
{
|
||||||
if (!is_array($user_id))
|
if (!is_array($user_id))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue