OK Guys, Eventually, I was able to make it work. This is what I have done below
Say for example, I have 2 plugins called as Partners and Properties.
In Partners plugin, I have coded something like this in my Plugin.php file.
plugins\technobrave\partners\Plugin.php
<?php namespace Technobrave\Partners;
use System\Classes\PluginBase;
use Backend;
use Event;
class Plugin extends PluginBase
{
public function registerNavigation()
{
return [
'modules' => [
'label' => 'Modules',
'url' => Backend::url('technobrave/properties/properties'),
'icon' => 'icon-bars',
'permissions' => ['Technobrave.Property.*'],
'sideMenu' => [
'properties' => [
'label' => 'Properties',
'icon' => 'icon-home',
'url' => Backend::url('technobrave/properties/properties'),
'permissions' => ['Technobrave.Property.*']
],
'partner' => [
'label' => 'Partners',
'icon' => 'icon-thumbs-up',
'url' => Backend::url('technobrave/partners/partners'),
'permissions' => ['Technobrave.Partner.*']
],
]
]
];
}
Here, as you can see above, My header menu link will redirect to Properties plugin as per my requirement and for left side bar menus, my first link will also be redirected to Properties plugin and next sub menu link will be redirected to Partners plugin.
Then I went to Partners controller and put code something like below.
plugins\technobrave\partners\controllers\Partners.php
<?php namespace Technobrave\Partners\Controllers;
use Backend\Classes\Controller;
use BackendMenu;
class Partners extends Controller
{
public function __construct()
{
parent::__construct();
BackendMenu::setContext('Technobrave.Partners', 'modules', 'partner');
}
}
Here above, as you can see, I have just executed the menu into partners plugin to be able to show it when I am inside partners listing or at CRUD operation or somewhere.
Similar thing I have done for Properties plugin as well to be able to show menu in Properties plugin. This is how my code looks like.
plugins\technobrave\properties\controllers\Properties.php
<?php namespace Technobrave\Properties\Controllers;
use Backend\Classes\Controller;
use BackendMenu;
class Properties extends Controller
{
public function __construct() {
parent::__construct();
BackendMenu::setContext('Technobrave.Partners', 'modules', 'properties');
}
}
One thing to note here in this code BackendMenu::setContext('Technobrave.Partners', 'modules', 'properties');
The Last argument is different than what we have put in Partners plugin.
BackendMenu::setContext('Technobrave.Partners', 'modules', 'properties');
This is to set as default selected menu from the list at left sidebar.
Hope this helps.