Skip to content

Collapsed menu dropdown missing 1st level items #255

@ddt368

Description

@ddt368

When using the NavBar collapse (for small screen) to convert Nav inline $menuItems to drop down list, which works, the variable menu items for Signup and Login do not appear on the dropdown.
Test example from view/layouts/main.php -- all 8 items appear on the full bar but only 6, Who-Why, appear on the collapsed dropdown. I expect to see Signup and Login, or Logout, as well. I am reporting this as a potential bug as I am not seeing where the array would have changed.

$menuItems = [
['label' => 'Who', 'url' => ['/site/who']],
['label' => 'What', 'url' => ['/site/what']],
['label' => 'When', 'url' => ['/site/when']],
['label' => 'Where', 'url' => ['/site/where']],
['label' => 'How', 'url' => ['/site/how']],
['label' => 'Why', 'url' => ['/site/why']],
];
if (Yii::$app->user->isGuest) {
$menuItems[] = ['label' => 'Signup', 'url' => ['/site/signup']];
$menuItems[] = ['label' => 'Login', 'url' => ['/site/login']];
} else {
$menuItems[] = '

  • '
    . Html::beginForm(['/site/logout'], 'post')
    . Html::submitButton(
    'Logout (' . Yii::$app->user->identity->username . ')',
    ['class' => 'btn btn-link logout']
    )
    . Html::endForm()
    . '
  • ';
    }

    Yii 2.024
    PHP 7.0.33
    Debian Stretch

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      Type

      No type

      Projects

      No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions