Answer the question
In order to leave comments, you need to log in
Why does Setting unknown property: yii\bootstrap\Dropdown::views occur?
I'm trying to create a menu using widgets Nav
and Navbar
like 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();
?>
Setting unknown property: yii\bootstrap\Dropdown::views
. Why? And how right?
Answer the question
In order to leave comments, you need to log in
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 questionAsk a Question
731 491 924 answers to any question