FieldAttributeManager::resolveEntityScope

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. FieldAttributeManager
  4. resolveEntityScope
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/attribute/fieldattributemanager.php
  • Класс: Bitrix\Crm\Attribute\FieldAttributeManager
  • Вызов: FieldAttributeManager::resolveEntityScope
static function resolveEntityScope($entityTypeId, $entityId, array $options = null): string
{
	$entityTypeId = (int)$entityTypeId;
	$entityId = (int)$entityId;

	if (!CCrmOwnerType::IsDefined($entityTypeId))
	{
		throw new Main\ArgumentException(
			'The argument must be valid CCrmOwnerType.',
			'entityTypeID'
		);
	}

	$categoryId = null;

	$factory = Crm\Service\Container::getInstance()->getFactory($entityTypeId);
	if ($factory)
	{
		if (is_array($options))
		{
			$categoryId = isset($options['CATEGORY_ID']) ? (int)$options['CATEGORY_ID'] : null;
		}
		if (is_null($categoryId) && $factory->isCategoriesSupported())
		{
			$categoryId = $factory->getItemCategoryId($entityId);

			if (is_null($categoryId))
			{
				$categoryId = $factory->createDefaultCategoryIfNotExist()->getId();
			}
		}
	}

	return static::getEntityScopeByCategory($categoryId);
}

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