diff --git a/config_defaults_inc.php b/config_defaults_inc.php index 49950fa72e..7120143111 100644 --- a/config_defaults_inc.php +++ b/config_defaults_inc.php @@ -3498,14 +3498,28 @@ /** * Add custom options to the main menu. For example: + * * $g_main_menu_custom_options = array( - * array( "My Link", MANAGER, 'my_link.php' ), - * array( "My Link2", ADMINISTRATOR, 'my_link2.php' ) + * array( + * 'title' => 'My Link', + * 'access_level' => MANAGER, + * 'url' => 'my_link.php', + * 'icon' => 'fa-plug' + * ), + * array( + * 'title' => 'My Link2', + * 'access_level' => ADMINISTRATOR, + * 'url' => 'my_link2.php', + * 'icon' => 'fa-plug' + * ) * ); * - * Note that if the caption is found in custom_strings_inc.php, then it will be - * replaced by the translated string. Options will only be added to the menu + * Note that if the caption is a localized string name (in strings_english.txt or custom_strings_inc.php), + * then it will be replaced by the translated string. Options will only be added to the menu * if the current logged in user has the appropriate access level. + * + * Use icons from http://fontawesome.io/icons/ - Add "fa-" prefix to icon name. + * * @global array $g_main_menu_custom_options */ $g_main_menu_custom_options = array(); diff --git a/core/layout_api.php b/core/layout_api.php index 6a163d0657..11f93121d9 100644 --- a/core/layout_api.php +++ b/core/layout_api.php @@ -823,11 +823,17 @@ function layout_config_menu_options_for_sidebar( $p_active_sidebar_page ) { $t_custom_options = config_get( 'main_menu_custom_options' ); foreach( $t_custom_options as $t_custom_option ) { - $t_menu_option = array(); - $t_menu_option['title'] = $t_custom_option[0]; - $t_menu_option['access_level'] = $t_custom_option[1]; - $t_menu_option['icon'] = 'fa-plug'; - $t_menu_option['url'] = $t_custom_option[2]; + if( isset( $t_custom_option['url'] ) ) { + $t_menu_option = $t_custom_option; + } else { + # Support < 2.0.0 custom menu options config format + $t_menu_option = array(); + $t_menu_option['title'] = $t_custom_option[0]; + $t_menu_option['access_level'] = $t_custom_option[1]; + $t_menu_option['icon'] = 'fa-plug'; + $t_menu_option['url'] = $t_custom_option[2]; + } + $t_menu_options[] = $t_menu_option; } diff --git a/docbook/Admin_Guide/en-US/config/html.xml b/docbook/Admin_Guide/en-US/config/html.xml index 4dd7c31010..c804455717 100644 --- a/docbook/Admin_Guide/en-US/config/html.xml +++ b/docbook/Admin_Guide/en-US/config/html.xml @@ -129,8 +129,18 @@ the link to be executed. For example: $g_main_menu_custom_options = array( - array( 'My Link', MANAGER, 'my_link.php' ), - array( 'My Link2', ADMINISTRATOR, 'my_link2.php' ), + array( + 'title' => 'My Link', + 'access_level' => MANAGER, + 'url' => 'my_link.php', + 'icon' => 'fa-plug' + ), + array( + 'title' => 'My Link2', + 'access_level' => ADMINISTRATOR, + 'url' => 'my_link2.php', + 'icon' => 'fa-plug' + ) ); Note that if the caption is found in the @@ -141,6 +151,10 @@ $g_main_menu_custom_options = array( the current logged in user has the appropriate access level. + + Use icons from Font Awesome. + Add "fa-" prefix to icon name. +