<div class="menu_item">
    <?= \yii\helpers\Html::a($rootCategory->categoryName->value, ['catalog/category', 'category' => $rootCategory], ['class' => 'submenu_button '. $rootClass])?>
    <div class="submenu">
        <ul class="categories">
            <li class="sub_cat"><span>Популярные категории</span>
                <?php if(!empty($populary)) :?>
                    <div class="sub_cat_content">
                        <div class="content_items">
                            <?php foreach($populary as $_item) :?>
                                <div class="content_item"><a href="<?= \yii\helpers\Url::to(['catalog/category', 'category' => $_item])?>">
                                        <div valign="top" class="picture">
                                            <?= $_item->imageUrl ? \common\components\artboximage\ArtboxImageHelper::getImage($_item->imageUrl, 'mainmenu') : ''?>
                                        </div>
                                        <div class="title"><?= $_item->categoryName->value?></div>
                                    </a></div>
                            <?php endforeach?>
                        </div>
                    </div>
                <?php endif?>
            </li>
        <?php foreach($items as $item) :?>
            <li class="sub_cat">
                <span><?= $item['item']->categoryName->value?></span>
                <?php if(!empty($item['children'])) :?>
                <div class="sub_cat_content">
                    <div class="content_items">
                        <?php foreach($item['children'] as $_item) :?>
                        <div class="content_item"><a href="<?= \yii\helpers\Url::to(['catalog/category', 'category' => $_item['item']])?>">
                            <div valign="top" class="picture">
                                <?= $_item['item']->imageUrl ? \common\components\artboximage\ArtboxImageHelper::getImage($_item['item']->imageUrl, 'mainmenu') : ''?>
                            </div>
                            <div class="title"><?= $_item['item']->categoryName->value?></div>
                        </a></div>
                        <?php endforeach?>
                    </div>
                </div>
                <?php endif?>
            </li>
        <?php endforeach ?>
        </ul>
    </div>
</div>
