Skip to main content
Topic: menu buttons with FontAwesome icons? (Read 2089 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

menu buttons with FontAwesome icons?

Is there a way to place FontAwesome icons in front of the text of the menu buttons (community, my messages, mentions and so on)?


Re: menu buttons with FontAwesome icons?

Reply #2

And this FontAwesome CSS code works in Subs.php out of the box? I thought this would be too easy.  ;)

Re: menu buttons with FontAwesome icons?

Reply #3

Yes,for more icons it may have to be updated => https://github.com/elkarte/Elkarte/issues/2186
Regards Stephan

Re: menu buttons with FontAwesome icons?

Reply #4

Works great, thanks a lot!  :)

Only problem ist the admin button which shows no icon. I think I made a mistake:

Code: [Select]
		// Will change title correctly if user is either a mod or an admin.
// Button highlighting works properly too (see current action stuffz).
if ($context['allow_admin'])
{
$buttons['admin'] = array(
'title' => '<i class="fa fa-cog fa-lg"></i> ' . $context['current_action'] !== 'moderate' ? $txt['admin'] : $txt['moderate'],
'counter' => 'grand_total',
'href' => $scripturl . '?action=admin',
'data-icon' => '',
'show' => true,
'sub_buttons' => array(
'admin_center' => array(
'title' => $txt['admin_center'],
'href' => $scripturl . '?action=admin',
'show' => $context['allow_admin'],
),
'featuresettings' => array(
'title' => $txt['modSettings_title'],
'href' => $scripturl . '?action=admin;area=featuresettings',
'show' => allowedTo('admin_forum'),
),
'packages' => array(
'title' => $txt['package'],
'href' => $scripturl . '?action=admin;area=packages',
'show' => allowedTo('admin_forum'),
),
'permissions' => array(
'title' => $txt['edit_permissions'],
'href' => $scripturl . '?action=admin;area=permissions',
'show' => allowedTo('manage_permissions'),
),
'errorlog' => array(
'title' => $txt['errlog'],
'href' => $scripturl . '?action=admin;area=logs;sa=errorlog;desc',
'show' => allowedTo('admin_forum') && !empty($modSettings['enableErrorLogging']),
),
'moderate_sub' => array(
'title' => $txt['moderate'],
'counter' => 'grand_total',
'href' => $scripturl . '?action=moderate',
'show' => $context['allow_moderation_center'],
'sub_buttons' => array(
'reports' => array(
'title' => $txt['mc_reported_posts'],
'counter' => 'reports',
'href' => $scripturl . '?action=moderate;area=reports',
'show' => !empty($user_info['mod_cache']) && $user_info['mod_cache']['bq'] != '0=1',
),
'modlog' => array(
'title' => $txt['modlog_view'],
'href' => $scripturl . '?action=moderate;area=modlog',
'show' => !empty($modSettings['modlog_enabled']) && !empty($user_info['mod_cache']) && $user_info['mod_cache']['bq'] != '0=1',
),
'attachments' => array(
'title' => $txt['mc_unapproved_attachments'],
'counter' => 'attachments',
'href' => $scripturl . '?action=moderate;area=attachmod;sa=attachments',
'show' => $modSettings['postmod_active'] && !empty($user_info['mod_cache']['ap']),
),
'poststopics' => array(
'title' => $txt['mc_unapproved_poststopics'],
'counter' => 'postmod',
'href' => $scripturl . '?action=moderate;area=postmod;sa=posts',
'show' => $modSettings['postmod_active'] && !empty($user_info['mod_cache']['ap']),
),
'postbyemail' => array(
'title' => $txt['mc_emailerror'],
'counter' => 'emailmod',
'href' => $scripturl . '?action=admin;area=maillist;sa=emaillist',
'show' => !empty($modSettings['maillist_enabled']) && allowedTo('approve_emails'),
),
),
),
),
);
}
else
{
$buttons['admin'] = array(
'title' => '<i class="fa fa-cog fa-lg"></i> ' . $txt['moderate'],
'counter' => 'grand_total',
'href' => $scripturl . '?action=moderate',
'data-icon' => '',
'show' => $context['allow_moderation_center'],
'sub_buttons' => array(
'reports' => array(
'title' => $txt['mc_reported_posts'],
'counter' => 'reports',
'href' => $scripturl . '?action=moderate;area=reports',
'show' => !empty($user_info['mod_cache']) && $user_info['mod_cache']['bq'] != '0=1',
),
'modlog' => array(
'title' => $txt['modlog_view'],
'href' => $scripturl . '?action=moderate;area=modlog',
'show' => !empty($modSettings['modlog_enabled']) && !empty($user_info['mod_cache']) && $user_info['mod_cache']['bq'] != '0=1',
),
'attachments' => array(
'title' => $txt['mc_unapproved_attachments'],
'counter' => 'attachments',
'href' => $scripturl . '?action=moderate;area=attachmod;sa=attachments',
'show' => $modSettings['postmod_active'] && !empty($user_info['mod_cache']['ap']),
),
'poststopics' => array(
'title' => $txt['mc_unapproved_poststopics'],
'counter' => 'postmod',
'href' => $scripturl . '?action=moderate;area=postmod;sa=posts',
'show' => $modSettings['postmod_active'] && !empty($user_info['mod_cache']['ap']),
),
'postbyemail' => array(
'title' => $txt['mc_emailerror'],
'counter' => 'emailmod',
'href' => $scripturl . '?action=admin;area=maillist;sa=emaillist',
'show' => !empty($modSettings['maillist_enabled']) && allowedTo('approve_emails'),
),
),
);
}

Re: menu buttons with FontAwesome icons?

Reply #5

Code: (this is wrong) [Select]
'title' => '<i class="fa fa-cog fa-lg"></i> ' . $context['current_action'] !== 'moderate' ? $txt['admin'] : $txt['moderate'],
Code: (needs to be) [Select]
'title' => '<i class="fa fa-cog fa-lg"></i> ' . ($context['current_action'] !== 'moderate' ? $txt['admin'] : $txt['moderate']),

Re: menu buttons with FontAwesome icons?

Reply #6

Perfect, thanks!  :)