PHP code example of gearmagicru / gm-wd-menu

1. Go to this page and download the library: Download gearmagicru/gm-wd-menu library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

gearmagicru / gm-wd-menu example snippets


$menu = Gm::$app->widgets->get('gm.wd.menu', ['menuId' => 1]);
$menu->run();

echo $this->widget('gm.wd.menu', ['menuId' => 1]);
// или
echo $this->widget('gm.wd.menu:top', ['menuId' => 1])

use Gm\Widget\Menu\Widget as Menu;
echo Menu::widget([
    'items' => [
        ['label' => 'Главная', 'url' => '/'],
        [
           'label' => 'Новости',
           'url'   => '#',
           'items' => [
               ['label' => 'Спорт', 'url' => 'news/sport'],
               ['label' => 'Игры',  'url' => 'news/games']
           ]
        ],
        ['label' => 'Авторизация', 'url' => 'login', 'visible' => Gm::$app->user->isGuest()]
    ]
]);