protected function getCategoryMenuOptions($obCategoryList)
    {
        if (empty($obCategoryList) || $obCategoryList->isEmpty()) {
            return null;
        }

        $arResult = [];
        foreach ($obCategoryList as $obCategory) {
            if ($obCategory->children->isEmpty()) {
                $arResult[$obCategory->id] = $obCategory->name;
            } else {
                $arResult[$obCategory->id] = [
                    'title' => $obCategory->name,
                    'items' => $this->getCategoryMenuOptions($obCategory->children),
                ];
            }
        }

        return $arResult;
    }
protected function getCategoryMenuOptions($obCategoryList)
    {
        if (empty($obCategoryList) || $obCategoryList->isEmpty()) {
            return null;
        }

        $arResult = [];
        foreach ($obCategoryList as $obCategory) {
            if ($obCategory->children->isEmpty()) {
                $arResult[$obCategory->id] = $obCategory->name;
            } else {
                $arResult[$obCategory->id] = [
                    'title' => $obCategory->name,
                    'items' => $this->getCategoryMenuOptions($obCategory->children),
                ];
            }
        }

        return $arResult;
    }
protected function getCategoryMenuOptions ( $ obCategoryList ) { if ( empty ( $ obCategoryList ) || $ obCategoryList -> isEmpty ( ) ) { return null ; } $ arResult = [ ] ; foreach ( $ obCategoryList as $ obCategory ) { if ( $ obCategory -> children -> isEmpty ( ) ) { $ arResult [ $ obCategory -> id ] = $ obCategory -> name ; } else { $ arResult [ $ obCategory -> id ] = [ 'title' => $ obCategory -> name , 'items' => $ this -> getCategoryMenuOptions ( $ obCategory -> children ) , ] ; } } return $ arResult ; }
Get option array for category
@param CategoryCollection|\Lovata\Shopaholic\Classes\Item\CategoryItem[] $obCategoryList
@return null|array|string
Get option array for category