CAllCrmCatalog::createMorePhoto

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. CAllCrmCatalog
  4. createMorePhoto
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/classes/general/crm_catalog.php
  • Класс: \CAllCrmCatalog
  • Вызов: CAllCrmCatalog::createMorePhoto
static function createMorePhoto(int $iblockId): void
{
	if (!Loader::includeModule('iblock'))
	{
		return;
	}

	$propertyId = \CIBlockPropertyTools::createProperty(
		$iblockId,
		\CIBlockPropertyTools::CODE_MORE_PHOTO
	);
	if (empty($propertyId))
	{
		return;
	}

	$features = [];
	$iterator = Iblock\PropertyFeatureTable::getList([
		'select' => ['*'],
		'filter' => ['=PROPERTY_ID' => $propertyId]
	]);
	while ($row = $iterator->fetch())
	{
		$features[] = [
			'MODULE_ID' => $row['MODULE_ID'],
			'FEATURE_ID' => $row['FEATURE_ID'],
			'IS_ENABLED' => $row['IS_ENABLED']
		];
	}
	unset($row, $iterator);
	$features[] = [
		'MODULE_ID' => 'iblock',
		'FEATURE_ID' => Iblock\Model\PropertyFeature::FEATURE_ID_LIST_PAGE_SHOW,
		'IS_ENABLED' => 'Y'
	];
	$features[] = [
		'MODULE_ID' => 'iblock',
		'FEATURE_ID' => Iblock\Model\PropertyFeature::FEATURE_ID_DETAIL_PAGE_SHOW,
		'IS_ENABLED' => 'Y'
	];

	$internaResult = Iblock\Model\PropertyFeature::setFeatures($propertyId, $features);
	$result = $internaResult->isSuccess();
	unset($features, $internaResult);
}

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