Entity::getDynamicMap

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. Entity
  4. getDynamicMap
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/webform/entity.php
  • Класс: Bitrix\Crm\WebForm\Entity
  • Вызов: Entity::getDynamicMap
static function getDynamicMap()
{
	static $dynamicTypeMap = null;
	if ($dynamicTypeMap !== null)
	{
		return $dynamicTypeMap;
	}

	//$types = Container::getInstance()->getFactory(\CCrmOwnerType::SmartDocument);
	$dynamicTypeMap = [];
	foreach (Container::getInstance()->getDynamicTypesMap()->load()->getTypesCollection() as $type)
	{
		$dynamicTypeMap[\CCrmOwnerType::resolveName($type->getEntityTypeId())] = array(
			'HIDDEN' => !\CCrmOwnerType::isPossibleDynamicTypeId($type->getEntityTypeId()),
			'GET_FIELDS_CALL' => function () use ($type) {
				$factory = Container::getInstance()->getFactory($type->getEntityTypeId());
				return $factory
					? array_merge($factory->getFieldsInfo(), $factory->getUserFieldsInfo())
					: []
				;
			},
			'CLEAR_FIELDS_CACHE_CALL' => function () use ($type) {
				$factory = Container::getInstance()->getFactory($type->getEntityTypeId());
				if ($factory)
				{
					$factory->clearUserFieldsInfoCache();
				}
			},
			'GET_FIELD_CAPTION' => function ($fieldName) use ($type) {
				$factory = Container::getInstance()->getFactory($type->getEntityTypeId());
				return $factory
					? $factory->getFieldCaption($fieldName)
					: null
				;
			},
			'FIELD_AUTO_FILL_TEMPLATE' => array(
				'TITLE' => array(
					'TEMPLATE' => Loc::getMessage('CRM_WEBFORM_ENTITY_FIELD_NAME_TEMPLATE'),
				),
			),
			'DUPLICATE_CHECK' => array(
				'CHECKER_CLASS_NAME' => null,
				'MERGER_CLASS_NAME' => Merger\DealMerger::class, // real is anonymus class
			),
		);
	}

	return $dynamicTypeMap;
}

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