IblockElement::renderControlOptions

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. IblockElement
  4. renderControlOptions
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/integration/bizproc/fieldtype/iblockelement.php
  • Класс: Bitrix\Crm\Integration\BizProc\FieldType\IblockElement
  • Вызов: IblockElement::renderControlOptions
static function renderControlOptions(FieldType $fieldType, $callbackFunctionName, $value)
{
	if (is_array($value))
	{
		reset($value);
		$valueTmp = (int) current($value);
	}
	else
	{
		$valueTmp = (int) $value;
	}

	$iblockId = 0;
	if ($valueTmp > 0)
	{
		$idKey = ($fieldType->getType() === 'UF:iblock_section') ? 'SECTION_ID' : 'ID';
		$elementIterator = \CIBlockElement::getList([], [$idKey => $valueTmp], false, false, array('ID', 'IBLOCK_ID'));
		if ($element = $elementIterator->fetch())
		{
			$iblockId = $element['IBLOCK_ID'];
		}
	}

	if ($iblockId <= 0 && (int) $fieldType->getOptions() > 0)
	{
		$iblockId = (int) $fieldType->getOptions();
	}

	$defaultIBlockId = 0;

	$result = '';
	$fieldType->setOptions($defaultIBlockId);

	return $result;
}

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