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

yii\bootstrap\Nav isItemActive doesn't work with implied /index #167

Closed
adhayward opened this issue Nov 24, 2016 · 1 comment
Closed

yii\bootstrap\Nav isItemActive doesn't work with implied /index #167

adhayward opened this issue Nov 24, 2016 · 1 comment

Comments

@adhayward
Copy link

If you have the following in your view:

<?= Nav::widget([
            'activateItems'=>true,
            'items' => [
                [
                    'label' => 'Item 1',
                    'url' => ['/item1/index'],
                ],
                [
                    'label' => 'Item 2',
                    'url' => ['/item2'],
                ],
            ],
        ]); ?>

If you click on Item 1 isItemActive returns true and it gets highlighted correctly.
If you click on Item 2 isItemActive returns false and it doesn't get highlighted.

The problem appears to be on the line
if (ltrim($route, '/') !== $this->route) {
where $route includes the /index and $this->route doesn't

@machour
Copy link
Member

machour commented Jan 15, 2019

Same as #209

@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
None yet
Projects
None yet
Development

No branches or pull requests

2 participants