Skip to content

Commit

Permalink
id may not be defined so check
Browse files Browse the repository at this point in the history
e.g.
```
$wgHooks['SidebarBeforeOutput'][] = function ( $skin, &$bar ) {
        # note: heading can be either a message key. If no message exists it will be treated as a plain
 text.
        $bar[ 'sunday' ] = [
                [
                        'label' => 'msg-myid',
                        'msg' => 'my-label-message',
                        'href' => '//example.com'
                ]
        ];
};
```

Fixes: #212
  • Loading branch information
jdlrobson authored and JeroenDeDauw committed Dec 31, 2020
1 parent 8cdb33e commit 64284f4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Components/NavMenu.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,9 @@ protected function buildMenuItemsForDropdownMenu( $menuDescription, $indent = 0
$this->indent( $indent );

foreach ( $menuDescription['content'] as $key => $item ) {
$id = $item['id'] ?? '';
$menuitems .= $this->indent() . $this->getSkinTemplate()->makeListItem( $key, $item,
[ 'tag' => 'div', 'class' => 'nav-item', 'link-class' => 'nav-link '.$item['id'] ] );
[ 'tag' => 'div', 'class' => 'nav-item', 'link-class' => 'nav-link '. $id ] );
}

$this->indent( - $indent );
Expand Down

0 comments on commit 64284f4

Please sign in to comment.