<?php
    use yii\web\UrlManager;
    
    $homeLink = [];
    /**
     * @var UrlManager $urlManagerFrontend
     */
    if ($urlManagerFrontend = \Yii::$app->get('urlManagerFrontend', false)) {
        $homeLink = [
            [
                'label'    => \Yii::t('core', 'My website'),
                'url'      => $urlManagerFrontend->createUrl([ 'site/index' ]),
                'icon'     => 'home',
                'template' => '<a href="{url}" target="_blank">{icon}<span>{label}</span>{badge}</a>',
                'options'  => [
                    'class' => 'homepage_link',
                ],
            ],
        ];
    }
    return array_merge(
        $homeLink,
        [
            [
                'label'  => \Yii::t('core', 'Main'),
                'url'    => [ '/site/index' ],
                'icon'   => ( \Yii::$app->controller->id === 'site' ) ? 'check' : 'undo',
                'active' => function () {
                    return \Yii::$app->controller->id === 'site';
                },
            ],
            [
                'label'  => \Yii::t('core', 'Static pages'),
                'url'    => [ 'page/index' ],
                'icon'   => 'file-text',
                'active' => function () {
                    return \Yii::$app->controller->id === 'page';
                },
            ],
            [
                'label' => \Yii::t('core', 'SEO'),
                'url'   => '#',
                'icon'  => 'bolt',
                'items' => [
                    [
                        'label' => \Yii::t('core', 'Seo pages'),
                        'url'   => [ 'alias/index' ],
                        'icon'  => 'file-text',
                    ],
                    [
                        'label' => \Yii::t('core', 'Robots'),
                        'url'   => [ 'settings/robots' ],
                        'icon'  => 'android',
                    ],
                    [
                        'label' => \Yii::t('core', 'Codes'),
                        'url'   => [ 'settings/codes' ],
                        'icon'  => 'code',
                    ],
                    [
                        'label' => \Yii::t('core', 'Sitemap'),
                        'url'   => [ '/sitemap/index' ],
                        'icon'  => 'map-signs',
                    ],
                ],
            ],
            [
                'label' => \Yii::t('app', 'Catalog'),
                'url'   => '#',
                'icon'  => 'tags',
                'items' => [
                    [
                        'label' => \Yii::t('catalog', 'Categories'),
                        'url'   => [ 'category/index' ],
                        'icon'  => 'file-text',
                    ],
                    [
                        'label' => \Yii::t('catalog', 'Brands'),
                        'url'   => [ 'brand/index' ],
                        'icon'  => 'file-text',
                    ],
                    [
                        'label' => \Yii::t('catalog', 'Products'),
                        'url'   => [ 'product/index' ],
                        'icon'  => 'gift',
                    ],
                    [
                        'label' => \Yii::t('catalog', 'Import'),
                        'url'   => [ 'import/index' ],
                        'icon'  => 'download',
                    ],
                ],
            ],
            [
                'label' => \Yii::t('app', 'Options'),
                'url'   => '#',
                'icon'  => 'filter',
                'items' => [
                    [
                        'label' => \Yii::t('app', 'Options for products'),
                        'url'   => '#',
                        'items' => [
                            [
                                'label' => \Yii::t('app', 'Complementary'),
                                'url'   => [ 'product-option-group-complementary/index' ],
                            ],
                            [
                                'label' => \Yii::t('app', 'Exclusion'),
                                'url'   => [ 'product-option-group-exclusion/index' ],
                            ],
                        ],
                    ],
                    [
                        'label' => \Yii::t('app', 'Options for variants'),
                        'url'   => '#',
                        'items' => [
                            [
                                'label' => \Yii::t('app', 'Complementary'),
                                'url'   => [ 'variant-option-group-complementary/index' ],
                            ],
                            [
                                'label' => \Yii::t('app', 'Exclusion'),
                                'url'   => [ 'variant-option-group-exclusion/index' ],
                            ],
                        ],
                    ],
                ],
            ],
            [
                'label' => \Yii::t('app', 'Blog'),
                'url'   => '#',
                'icon'  => 'pencil-square',
                'items' => [
                    [
                        'label' => \Yii::t('catalog', 'Articles'),
                        'url'   => [ 'blog-article/index' ],
                        'icon'  => 'file-text',
                    ],
                    [
                        'label' => \Yii::t('catalog', 'Categories'),
                        'url'   => [ 'blog-category/index' ],
                        'icon'  => 'book',
                    ],
                    [
                        'label' => \Yii::t('catalog', 'Tags'),
                        'url'   => [ 'blog-tag/index' ],
                        'icon'  => 'tag',
                    ],
                ],
            ],
            [
                'label' => \Yii::t('order', 'Order'),
                'url'   => '#',
                'icon'  => 'archive',
                'items' => [
                    [
                        'label' => \Yii::t('order', 'Orders'),
                        'url'   => [ 'order/index' ],
                        'icon'  => 'first-order',
                    ],
                    [
                        'label' => \Yii::t('order', 'Label'),
                        'url'   => [ 'label/index' ],
                        'icon'  => 'tag',
                    ],
                    [
                        'label' => \Yii::t('order', 'Delivery'),
                        'url'   => [ 'delivery/index' ],
                        'icon'  => 'truck',
                    ],
                    [
                        'label' => \Yii::t('order', 'Payment'),
                        'url'   => [ 'payment/index' ],
                        'icon'  => 'money',
                    ],
                ],
            ],
        ]
    );