Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
entity.php
1<?php
3
4abstract class Entity
5{
9 const TITLE_LENGTH = 30;
10
18 protected static function getDiskFiles(int $sourceId, string $entityType, string $module): array
19 {
20 $files = [];
21
22 if (\Bitrix\Main\Loader::includeModule('disk'))
23 {
24 $userId = \Bitrix\Landing\Manager::getUserId();
25 $filePrefix = \Bitrix\Disk\Uf\FileUserType::NEW_FILE_PREFIX;
26 $attachedModels = \Bitrix\Disk\AttachedObject::getModelList([
27 'filter' => [
28 '=ENTITY_ID' => $sourceId,
29 '=ENTITY_TYPE' => $entityType,
30 '=MODULE_ID' => $module
31 ]
32 ]);
33 foreach ($attachedModels as $attachedModel)
34 {
35 if (!$attachedModel->canRead($userId))
36 {
37 continue;
38 }
39 $item = [
40 'id' => $attachedModel->getId(),
41 'object_id' => $attachedModel->getObjectId(),
42 'file_id' => $attachedModel->getFileId(),
43 'file_name' => $attachedModel->getName(),
44 'prefix' => ''
45 ];
46 $files[$attachedModel->getId()] = $item;
47 $item['prefix'] = $filePrefix;
48 $files[$filePrefix . $attachedModel->getObjectId()] = $item;
49 }
50 }
51
52 return $files;
53 }
54
60 abstract public static function getData(int $sourceId): ?array;
61}
static getData(int $sourceId)
static getDiskFiles(int $sourceId, string $entityType, string $module)
Definition entity.php:18