mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-25 12:35:55 +02:00
[ticket/12668] Add subforums_row to core.display_forums_modify_template_vars
Add subforums template data array to 'core.display_forums_modify_template_vars' event to allow extensions to modify it if needed. PHPBB3-12668
This commit is contained in:
@ -497,10 +497,15 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod
|
||||
$l_post_click_count = ($row['forum_type'] == FORUM_LINK) ? 'CLICKS' : 'POSTS';
|
||||
$post_click_count = ($row['forum_type'] != FORUM_LINK || $row['forum_flags'] & FORUM_FLAG_LINK_TRACK) ? $row['forum_posts'] : '';
|
||||
|
||||
$s_subforums_list = array();
|
||||
$s_subforums_list = $subforums_row = array();
|
||||
foreach ($subforums_list as $subforum)
|
||||
{
|
||||
$s_subforums_list[] = '<a href="' . $subforum['link'] . '" class="subforum ' . (($subforum['unread']) ? 'unread' : 'read') . '" title="' . (($subforum['unread']) ? $user->lang['UNREAD_POSTS'] : $user->lang['NO_UNREAD_POSTS']) . '">' . $subforum['name'] . '</a>';
|
||||
$subforums_row[] = array(
|
||||
'U_SUBFORUM' => $subforum['link'],
|
||||
'SUBFORUM_NAME' => $subforum['name'],
|
||||
'S_UNREAD' => $subforum['unread'],
|
||||
);
|
||||
}
|
||||
$s_subforums_list = (string) implode($user->lang['COMMA_SEPARATOR'], $s_subforums_list);
|
||||
$catless = ($row['parent_id'] == $root_data['forum_id']) ? true : false;
|
||||
@ -572,22 +577,17 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod
|
||||
* @event core.display_forums_modify_template_vars
|
||||
* @var array forum_row Template data of the forum
|
||||
* @var array row The data of the forum
|
||||
* @var array subforums_row Template data of subforums
|
||||
* @since 3.1.0-a1
|
||||
* @change 3.1.0-b5 Added var subforums_row
|
||||
*/
|
||||
$vars = array('forum_row', 'row');
|
||||
$vars = array('forum_row', 'row', 'subforums_row');
|
||||
extract($phpbb_dispatcher->trigger_event('core.display_forums_modify_template_vars', compact($vars)));
|
||||
|
||||
$template->assign_block_vars('forumrow', $forum_row);
|
||||
|
||||
// Assign subforums loop for style authors
|
||||
foreach ($subforums_list as $subforum)
|
||||
{
|
||||
$template->assign_block_vars('forumrow.subforum', array(
|
||||
'U_SUBFORUM' => $subforum['link'],
|
||||
'SUBFORUM_NAME' => $subforum['name'],
|
||||
'S_UNREAD' => $subforum['unread'])
|
||||
);
|
||||
}
|
||||
$template->assign_block_vars_array('forumrow.subforum', $subforums_row);
|
||||
|
||||
/**
|
||||
* Modify and/or assign additional template data for the forum
|
||||
@ -600,6 +600,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod
|
||||
* @var array forum_row Template data of the forum
|
||||
* @var array row The data of the forum
|
||||
* @var array subforums_list The data of subforums
|
||||
* @var array subforums_row Template data of subforums
|
||||
* @var bool catless The flag indicating whether a forum has a parent category
|
||||
* @since 3.1.0-b5
|
||||
*/
|
||||
@ -607,6 +608,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod
|
||||
'forum_row',
|
||||
'row',
|
||||
'subforums_list',
|
||||
'subforums_row',
|
||||
'catless',
|
||||
);
|
||||
extract($phpbb_dispatcher->trigger_event('core.display_forums_add_template_data', compact($vars)));
|
||||
|
Reference in New Issue
Block a user