Renderlife
10/11/2019 - 6:44 AM

Получить все разделы по id инфоблока

<?php

public function getAllSectionFrom($iBlockId, $filter)
{       
    $sections = [];

    $arFilter = ['IBLOCK_ID' => $iBlockId, 'GLOBAL_ACTIVE' => 'Y'] + $filter;
    $db_list = \CIBlockSection::GetList([$by => $order], $arFilter, true);
    while($ar_result = $db_list->GetNext()) {
        $sections[] = [
            'id' => $ar_result['ID'],
            'code' => $ar_result['CODE'],
            'name' => $ar_result['NAME'],
        ];
    }
    
    return $sections;
}