Add a project specific custom menu link

Get help from other users here.

Moderators: Developer, Contributor

Post Reply
RedSpider
Posts: 36
Joined: 30 Jan 2015, 19:47

Add a project specific custom menu link

Post by RedSpider »

Hi, i wondered if it is possible to add a custom menu link that is project specific?

I've had a look around and I can see there seems to be a $g_main_menu_custom_options option but I assume that is global, and I want to add some project specific links

any help would be appreciated :)
atrol
Site Admin
Posts: 8366
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Add a project specific custom menu link

Post by atrol »

There is a function helper_get_current_project that returns the current project id.
You can set $g_main_menu_custom_options depending on the return value of the function.
Please use Search before posting and read the Manual
RedSpider
Posts: 36
Joined: 30 Jan 2015, 19:47

Re: Add a project specific custom menu link

Post by RedSpider »

atrol wrote:There is a function helper_get_current_project that returns the current project id.
You can set $g_main_menu_custom_options depending on the return value of the function.
interesting, I didn't know that. How would I go about this, do I still need to add $g_main_menu_custom_options via config or can I do this via the config options on the admin cp?
atrol
Site Admin
Posts: 8366
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Add a project specific custom menu link

Post by atrol »

You have to implement it in config_inc.php
Please use Search before posting and read the Manual
RedSpider
Posts: 36
Joined: 30 Jan 2015, 19:47

Re: Add a project specific custom menu link

Post by RedSpider »

atrol wrote:You have to implement it in config_inc.php
okay thanks. Is there an example on how to use this? eg only show this menu if project id = 3

Edit; Managed to figure it out, thanks :)
deepakv
Posts: 2
Joined: 09 Sep 2017, 21:34

Re: Add a project specific custom menu link

Post by deepakv »

I am not able to do that... Can you assist me for adding custom menu link specific to project

Thanks
deepakv
Posts: 2
Joined: 09 Sep 2017, 21:34

Re: Add a project specific custom menu link

Post by deepakv »

In config_inc I am doing this
if (helper_get_current_project() == 1)
{
$g_main_menu_custom_options = array( array(
'title' => 'Staging',
'access_level' => 'NOBODY',
'url' => 'https://test.com',
'icon' => 'fa-plug'), );
};
Post Reply