<div class="menu_item">
    <?= \yii\helpers\Html::a($rootCategory->name, ['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">
                                            <?php if (empty($_item->image)) :?>
                                            <img valign="top" src="/storage/no_photo.png">
                                            <?php else :?>
                                                <?= $_item->imageUrl ? \common\components\artboximage\ArtboxImageHelper::getImage($_item->imageUrl, 'mainmenu') : ''?>
                                            <?php endif?>
                                        </div>
                                        <div class="title"><?= $_item->name?></div>
                                    </a></div>
                            <?php endforeach?>
                        </div>
                    </div>
                <?php endif?>
            </li>
        <?php foreach($items as $item) :?>
            <li class="sub_cat">
                <span><?= $item['item']->name?></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">
                                <?php if (empty($_item['item']->image)) :?>
                                    <img valign="top" src="/storage/no_photo.png">
                                <?php else :?>
                                    <?= $_item['item']->imageUrl ? \common\components\artboximage\ArtboxImageHelper::getImage($_item['item']->imageUrl, 'mainmenu') : ''?>
                                <?php endif?>
                            </div>
                            <div class="title"><?= $_item['item']->name?></div>
                        </a></div>
                        <?php endforeach?>
                    </div>
                </div>
                <?php endif?>
            </li>
        <?php endforeach ?>
        </ul>
    </div>
</div>
