Category::processLogic

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. Category
  4. processLogic
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/Field/Category.php
  • Класс: Bitrix\Crm\Field\Category
  • Вызов: Category::processLogic
protected function processLogic(Item $item, Context $context = null): Result
{
	$result = new Result();
	if (!$item->isChanged($this->getName()))
	{
		return $result;
	}

	$factory = Container::getInstance()->getFactory($item->getEntityTypeId());
	if (!$factory)
	{
		return $result->addError($this->getFactoryNotFoundError($item->getEntityTypeId()));
	}

	$this->validateCategoryId($factory, $item->get($this->getName()), $result);
	if (!$result->isSuccess())
	{
		return $result;
	}

	$eventNames = $this->getSettings()['eventNames'] ?? [];
	if (!empty($eventNames['onBeforeChange']) && !$item->isNew())
	{
		$this->sendOnBeforeCategoryChangeEvent($eventNames['onBeforeChange'], $item);

		$this->validateCategoryId($factory, $item->get($this->getName()), $result);
		if (!$result->isSuccess())
		{
			return $result;
		}
	}

	return $result;
}

Добавить комментарий