As in the widget menu to move items to the right part with a dropdown list?

Hello fellow friends!

There is a main menu (standard yii-bootstrap widget)

item 1 item 3 пункт2 Ivan Petrov ↓

how to move not all menu items but only the last part right and that it opened a dropdown with several items? Something analysis of the official docks I did not help. Can you help..

Thank you.

p.s.
<?php
NavBar::begin([
 'brandLabel' =--> Yii::$app->name,
 'brandUrl' => Yii::$app->homeUrl,
 'options' => [
 'class' => 'navbar-inverse navbar-fixed-top',
],
]);
 $menuItems = [
 ['label' => 'Home', 'url' => ['/site/index']],
];
 if (Yii::$app->user->isGuest) {
 $menuItems[] = ['label' => 'Signup', 'url' => ['/site/signup']];
 $menuItems[] = ['label' => 'Login', 'url' => ['/site/login']];
 } else {
 $menuItems[] = '<li>'
 . Html::beginForm(['/site/logout'], 'post')
 . Html::submitButton(
 'Logout (' . Yii::$app->user->identity->username . ')',
 ['class' => 'btn btn-link logout']
)
 . Html::endForm()
 . '</li>';
}
 echo Nav::widget([
 'options' => ['class' => 'navbar-nav'],
 'items' => $menuItems,
]);
NavBar::end();
 ?>
June 10th 19 at 15:34
2 answers
June 10th 19 at 15:36
Drop down to do so
['label' => 'Title', 'items' => [
 ['label' => 'City', 'url' => ['/city/index']],
 ['label' => 'Studio', 'url' => ['/studio/index']],
 ['label' => 'Lessons', 'url' => ['/user/index']],
 ['label' => 'Tags', 'url' => ['/tag/index']],
]],


move not all menu items but only the last part right

Through :last-child in css to set the styles of the last element
htmlbook.ru/css/last-child
June 10th 19 at 15:38
to me that's confusing:
$menuItems[] = '<li>'
 . Html::beginForm(['/site/logout'], 'post')
 . Html::submitButton(
 'Logout (' . Yii::$app->user->identity->username . ')',
 ['class' => 'btn btn-link logout']
)
 . Html::endForm()
 . '</li>';

how to add another dropdown list. why then the array is filled at once with '.... but not all elements:
$menuItems[] = ['label' => 'Login', 'url' => ['/site/login']];
how to add another dropdown list

append after . "; on the trail of the string

$menuItems = [
 ['label' => 'Dropdown', 'items' => [
 ['label' => 'City', 'url' => ['/city/index']],
 ['label' => 'Studio', 'url' => ['/studio/index']],
 ['label' => 'Lessons', 'url' => ['/user/index']],
 ['label' => 'Tags', 'url' => ['/tag/index']],
]],
];


But this list will be visible only to logged in - Mohamed_Lind75 commented on June 10th 19 at 15:41
and can we get him to the right to move through options without resorting to css? - audrey_Kautz commented on June 10th 19 at 15:44
why then the array is filled at once with '....

not sure what you mean by the ellipsis refers to - Mohamed_Lind75 commented on June 10th 19 at 15:47
there was
'
    ...
- audrey_Kautz commented on June 10th 19 at 15:50
his-who?
depends what it is and where to shove it... and you can ask the class - Mohamed_Lind75 commented on June 10th 19 at 15:53

Find more questions by tags Yii