• Модуль: crmmobile
  • Путь к файлу: ~/bitrix/modules/crmmobile/lib/Controller/Category.php
  • Класс: BitrixCrmMobileControllerCategory
  • Вызов: Category::createAction
public function createAction(Factory $factory, array $fields): ?int
{
	$newCategory = $factory->createCategory($fields);

	if (!Container::getInstance()->getUserPermissions()->canAddCategory($newCategory))
	{
		$this->addError(ErrorCode::getAccessDeniedError());

		return null;
	}

	$result = $newCategory->save();
	if (!$result->isSuccess())
	{
		$this->addErrors($result->getErrors());

		return null;
	}

	return $newCategory->getId();
}