Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set menu item active without controller action #245

Closed
yii-bot opened this issue Oct 25, 2018 · 1 comment
Closed

Set menu item active without controller action #245

yii-bot opened this issue Oct 25, 2018 · 1 comment
Labels
status:to be verified Needs to be reproduced and validated. type:bug Bug

Comments

@yii-bot
Copy link

yii-bot commented Oct 25, 2018

This issue has originally been reported by @titusvk at yiisoft/yii2#16808.
Moved here by @cebe.


What steps will reproduce the problem?

Bootstrap Nav Widget doesn't set active menu item status when url param has no action.

What is the expected result?

Maybe we can anticipate, the default action is index.

What do you get instead?

I'm not sure with the following solution:

    protected function isItemActive($item)
    {
        if (!$this->activateItems) {
            return false;
        }

        if (isset($item['url']) && is_array($item['url']) && isset($item['url'][0])) {
            $route = $item['url'][0];

            **if (strpos(ltrim($route, '/'), '/') === false)
            {
                $route .= '/index';
            }**

Additional info

Q A
Yii version 2.0.?
PHP version
Operating system
@machour
Copy link
Member

machour commented Jan 15, 2019

Duplicate of #209

@machour machour marked this as a duplicate of #209 Jan 15, 2019
@machour machour closed this as completed Jan 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:to be verified Needs to be reproduced and validated. type:bug Bug
Projects
None yet
Development

No branches or pull requests

3 participants