duannian7116 2017-04-21 10:11
浏览 41
已采纳

OctoberCMS registerNavigation当前活动子菜单链接的错误状态

I have been using OctoberCMS(Builder Plugin) to create different plugins, which works well.

I have a plugin called as Partners and in Plugin.php file code , I have below code.

Plugin.php code

public function registerNavigation()
    {
        return [
            'modules' => [
                'label'       => 'Modules',
                'url'         => Backend::url('technobrave/partners/partners'),
                'icon'        => 'icon-bars',
                'permissions' => ['Technobrave.Partner.*'],

                'sideMenu'    => [
                    'partner' => [
                            'label' => 'Partners',
                            'icon'        => 'icon-thumbs-up',
                            'url'         => Backend::url('technobrave/partners/partners'),
                            'permissions' => ['Technobrave.Partner.*']

                    ],
                    'team' => [
                            'label' => 'Team',
                            'icon'        => 'icon-group',
                            'url'         => Backend::url('technobrave/team/team'),
                            'permissions' => ['Technobrave.Team.*']
                    ]
                ]
            ]
        ];
    }

And here below is my Partners.php controller file code

Partners.php controller code

public function __construct()
    {
        parent::__construct();             
        BackendMenu::setContext('Technobrave.Partners', 'modules', 'team');
    }

Everything works fine apart from my current active class, even if I am on the Partners page, it is still selecting "Team" as current menu link. Below is the screen shot with browser URL for better understanding.

enter image description here

As you can see above, I am on Partners page still its showing current active URL as Team page. Can someone help me how to handle this ?

Thanks

PS: Added PHP tag if someone tag just for the shake of help I need if someone knows and had ever come across using this CMS.

  • 写回答

1条回答 默认 最新

  • doukang7486 2017-04-21 10:20
    关注

    You need to set the menu context for each controller. For the Partners.php use this:

    public function __construct()
    {
        parent::__construct();             
        BackendMenu::setContext('Technobrave.Partners', 'modules', 'partner');
    }
    

    And for the Team.php use this:

    public function __construct()
    {
        parent::__construct();             
        BackendMenu::setContext('Technobrave.Partners', 'modules', 'team');
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?