yiisoft / yii-bootstrap5

Yii Framework Bootstrap 5 support
https://www.yiiframework.com/
BSD 3-Clause "New" or "Revised" License
63 stars 19 forks source link

improve $menuItems example in Nav class #81

Closed albertborsos closed 2 years ago

albertborsos commented 2 years ago

This example: https://github.com/yiisoft/yii-bootstrap5/blob/921bb6f2779600185d6ab71145ba7c38ada5b1f7/src/Nav.php#L21-L51

would look better this way:

 *    $menuItems = [
 *        [
 *            'label' => 'About',
 *            'url' => '/about',
 *        ],
 *        [
 *            'label' => 'Contact',
 *            'url' => '/contact',
 *        ],
 *        [
 *            'label' => 'Login',
 *            'url' => '/login',
 *            'visible' => $user->getId() === null,
 *        ],
 *        [
 *            'label' => 'Logout' . ' ' . '(' . $user->getUsername() . ')',
 *            'url' => '/logout',
 *            'visible' => $user->getId() !== null,
 *        ],
 *    ];
vjik commented 2 years ago

Looks good. Can you create pull request?