• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/rest/controllers/task.php
  • Класс: BitrixTasksRestControllersTask
  • Вызов: Task::makeTree
private function makeTree($nodeId, $root, $sortIndex, $displaySortIndex): CheckList
{
	$root['SORT_INDEX'] = $sortIndex;
	$root['DISPLAY_SORT_INDEX'] = htmlspecialcharsbx($displaySortIndex);

	$tree = new CheckList(
		$nodeId,
		$this->getCurrentUser()->getId(),
		TaskCheckListFacade::class,
		$root
	);

	$localSortIndex = 0;
	foreach ($root['SUB_TREE'] as $item)
	{
		++$localSortIndex;

		$nextDisplaySortIndex = (
			$displaySortIndex === false
				? $localSortIndex
				: "$displaySortIndex.$localSortIndex"
		);

		$tree->add($this->makeTree(++$nodeId, $item, $localSortIndex - 1, $nextDisplaySortIndex));
	}

	return $tree;
}