• Модуль: catalog
  • Путь к файлу: ~/bitrix/modules/catalog/lib/v2/BaseIblockElementEntity.php
  • Класс: BitrixCatalogv2BaseIblockElementEntity
  • Вызов: BaseIblockElementEntity::setField
public function setField(string $name, $value): BaseEntity
{
	if ($name === 'IBLOCK_ID')
	{
		$iblockId = $this->getIblockId();

		// ToDo make immutable field type in type caster
		if ($iblockId !== null && $iblockId != $value)
		{
			throw new NotSupportedException('Iblock id field has been already initialized.');
		}
	}
	elseif ($name === 'DETAIL_PICTURE' || $name === 'PREVIEW_PICTURE')
	{
		$imageCollection = $this->getImageCollection();
		$image =
			$name === 'DETAIL_PICTURE'
				? $imageCollection->getDetailImage()
				: $imageCollection->getPreviewImage();

		if (is_numeric($value))
		{
			$value = CFile::MakeFileArray($value);
		}

		if (is_array($value))
		{
			$image->setFileStructure($value);
		}

		return $this;
	}

	return parent::setField($name, $value);
}