• Модуль: disk
  • Путь к файлу: ~/bitrix/modules/disk/lib/integration/filediskproperty.php
  • Класс: BitrixDiskIntegrationFileDiskProperty
  • Вызов: FileDiskProperty::deleteAttachedFiles
static function deleteAttachedFiles($iblockId, $listAttachedId)
{
	if(!(int)$iblockId || !is_array($listAttachedId))
	{
		return;
	}

	$userFieldManager = Driver::getInstance()->getUserFieldManager();
	list($connectorClass, $moduleId) = $userFieldManager->getConnectorDataByEntityType("iblock_workflow");
	foreach($listAttachedId as $value)
	{
		$attachedModel = AttachedObject::load(array(
			'OBJECT_ID' => $value,
			'=ENTITY_TYPE' => $connectorClass,
			'=ENTITY_ID' => $iblockId,
			'=MODULE_ID' => $moduleId
		));
		if(!$attachedModel)
		{
			continue;
		}

		if($userFieldManager->belongsToEntity($attachedModel, "iblock_workflow", $iblockId))
		{
			$attachedModel->delete();
		}
	}
}