• Модуль: disk
  • Путь к файлу: ~/bitrix/modules/disk/lib/volume/file.php
  • Класс: BitrixDiskVolumeFile
  • Вызов: File::getAttachedList
static function getAttachedList(VolumeFragment $fragment, $userId)
{
	$file = $fragment->getFile();
	if (!$file instanceof DiskFile)
	{
		throw new ArgumentTypeException('Fragment must be subclass of '.DiskFile::className());
	}

	$attached = [];

	if ($fragment->getAttachedCount() > 0)
	{
		$attachedObjects = $file->getAttachedObjects();
		if($attachedObjects)
		{
			foreach($attachedObjects as $attachedObject)
			{
				if ($attachedObject instanceof DiskAttachedObject)
				{
					try
					{
						$connector = $attachedObject->getConnector();

						$dataToShow = $connector->getDataToShow();
						if ($dataToShow)
						{
							$attached[$attachedObject->getEntityId()] = [
								'title' => $dataToShow['TITLE'],
							];
							if ($attachedObject->canRead($userId))
							{
								if (!empty($dataToShow['DETAIL_URL']))
								{
									$attached[$attachedObject->getEntityId()]['url'] = $dataToShow['DETAIL_URL'];
								}
							}
						}
					}
					catch (BitrixMainSystemException $exception)
					{
					}
				}
			}
		}
	}

	return $attached;
}