S
S
Sergey Beloventsev2016-10-05 21:56:14
Yii
Sergey Beloventsev, 2016-10-05 21:56:14

Why does Setting unknown property: yii\bootstrap\Dropdown::views occur?

I'm trying to create a menu using widgets Navand Navbarlike this

NavBar::begin([]);
        $menuItems = [
            ['label' => 'Home', 'url' => ['/site/index']],
            ['label' => 'About', 'url' => ['/site/about']],
            ['label' => 'Contact', 'url' => ['/site/contact']],
            ['label' => 'Contact', 'url' => ['/site/contact'], 'items' => [
                ['label' => 'Home', 'url' => ['/site/index']],
                ['label' => 'About', 'url' => ['/site/about']],
                ['label' => 'Contact', 'url' => ['/site/contact']],
            ]],
        ];
        if (Yii::$app->user->isGuest) {
            $menuItems[] = ['label' => 'Register', 'url' => ['/user/registration/register'], 'visible' => Yii::$app->user->isGuest];
            $menuItems[] = ['label' => 'Login', 'url' => ['/user/security/login']];
        } else {
            $menuItems[] = ['label' => 'Profile', 'url' => ['/user/settings/profile']];
            $menuItems[] = ['label' => 'Setting', 'url' => ['/user/settings/account']];
            $menuItems[] = ['label' => 'Admin', 'url' => ['/user/admin/index']];
            $menuItems[] = '<li>'
                . Html::beginForm(['/user/security/logout'], 'post')
                . Html::submitButton(
                    'Logout (' . Yii::$app->user->identity->username . ')',
                    ['class' => 'btn btn-link']
                )
                . Html::endForm()
                . '</li>';
        }
        echo Nav::widget([
            'options' => ['class' => 'navbar-nav navbar-right'],
            'items' => $menuItems,
        ]);
        NavBar::end();
        ?>

but i get an error
Setting unknown property: yii\bootstrap\Dropdown::views
. Why? And how right?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Fedorov, 2016-10-06
@Sergalas

The code you provided is correct and does not contain any errors. Look for the error elsewhere - through the search in the IDE, find the place where this parameter is defined

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question