Look in the function setupMenuContext in Subs.php.
You will find lines like 'data-icon' => '& #xf015;' in the buttons array. That is the hex code for a font awesome character to use. You can find all those codes listed next to the icons here: http://fortawesome.github.io/Font-Awesome/cheatsheet/
Alternatively, you could do it all in the css but you will have to specify all the buttons ... so today we have:
[data-icon]:before {
font-family: 'FontAwesome';
border: 3px solid #666;
padding: 1px;
margin: 2px;
height: 1.15em;
width: 1.15em;
text-align: center;
display: inline-block;
border-radius: 4px;
line-height: 1.2em;
font-size: 2em;
color: #555;
content: attr(data-icon);
}
That single blocks defines all of the mobile icons, the content is set from the data-icon attribute. You could replace that block with for example
#button_home:before, #button_pm:before {
font-family: 'FontAwesome';
border: 3px solid #666;
padding: 1px;
margin: 2px;
height: 1.15em;
width: 1.15em;
text-align: center;
display: inline-block;
border-radius: 4px;
line-height: 1.2em;
font-size: 2em;
color: #555;
}
#button_home:before {
content: '\f015';
}
#button_pm:before {
content: '\f19c';
}
for the home button, and the PM button as an example. You would have to add for all of the other buttons you want.
I wonder if at some point we will be able to move that icons out of setupMenuContext and into the theme...
May make sense for 1.1, I think what I posted above would work fine, and then simply remove the data_icon attribute from subs.
Thanks,
@Spuds worked great! :)
Another question I have with this idea is that - remember I am absoluty not into coding - my menu button für drafts will not work for registered members. I have added this in Subs.php:
// Eigener Button zu den Entwürfen.
'drafts1' => array(
'title' => 'Entwürfe',
'href' => $scripturl . '?action=profile;area=showdrafts',
'show' => !empty($modSettings['drafts_enabled']) && !empty($modSettings['drafts_post_enabled']) && allowedTo('post_draft'),
),
But it doesn't work, the button is not shown. It only is when I use this:
// Eigener Button zu den Entwürfen.
'drafts1' => array(
'title' => 'Entwürfe',
'href' => $scripturl . '?action=profile;area=showdrafts',
'show' => !$user_info['is_guest'],
),
I want to display the button only if the function is enabled und the user has the permission to use it. Can anyone see my error?
That looks fine to me ... not sure why its not working for you. I took you code and placed it in subs and the button was shown.
As a normal member? Logged in as administrator I see the button too. But not as normal member (which has the permission to use drafts).
Another small question. When I add a code like this into Subs.php:
// Eigener Button für die Stromtankstellen-Karte.
'tankstellen' => array(
'title' => 'Stromtankstellen',
'href' => 'http://elektro-piloten.de/karte.html',
'show' => !$user_info['is_guest'],
),
...to create a new button in the menu, is there something more I have to do? Maybe because of "tankstellen", does this need to be in any more files?
Nope.
The "tankstellen" (the key) is there to identify the button if you need to access it from other places. ;)
Great, thanks! So the only problem is this:
O:-)
Can you attach the modified file that doesn't work?
Sure. This is the part that doesn't work:
// Eigener Button zu den Entwürfen.
'drafts1' => array(
'title' => 'Entwürfe',
'href' => $scripturl . '?action=profile;area=showdrafts',
/* 'show' => !$user_info['is_guest'], */
'show' => !empty($modSettings['drafts_enabled']) && !empty($modSettings['drafts_post_enabled']) && allowedTo('post_draft'),
),
It's line 3565.
"post_draft" is a board-level permission, that means it will return a correct value only when inside a specific board.
So, the easy way out is to use simply:
// Eigener Button zu den Entwürfen.
'drafts1' => array(
'title' => 'Entwürfe',
'href' => $scripturl . '?action=profile;area=showdrafts',
'show' => !empty($modSettings['drafts_enabled']) && !empty($modSettings['drafts_post_enabled']),
),
Maybe boards for authors need the possibility to allow drafts in some boards and in some not?
Thanks for the support! :)
@Jorin, I encourage you to use a hook here instead of editing Subs.php directly. Future updates of Elk will surely break this.
I was thinking the same, though I always feel uneasy suggesting use hooks to non-coders...
And that's also for that reason that I have introduced some trick in 1.1 that should make much easier to use hooks for non-coders (I hope).
I hope too! :D At the moment I wrote down all changes to a text file so I can make them after an update again. An easy way to use hooks and/or a really easy to understand manual would be great!
Easy, easy, easy, may be too much, but at least easier.
Your change should look something like this:
<?php
class Custom_Integrate
{
public static function register()
{
// $hook, $function, $file
return array(
array(
'integrate_menu_buttons',
'Custom_Integrate::menu_buttons',
),
);
}
public static function menu_buttons(&$buttons)
{
global $modSettings, $scripturl;
$buttons = elk_array_insert($buttons, 'pm', array(
// Eigener Button zu den Entwürfen.
'drafts1' => array(
'title' => 'Entwürfe',
'href' => $scripturl . '?action=profile;area=showdrafts',
'show' => !empty($modSettings['drafts_enabled']) && !empty($modSettings['drafts_post_enabled']),
)
),
'after',
false
);
}
}
And you would be able to enable/disable the "integration" directly from the admin panel.