Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
FilePopupItem.php
1<?php
2
4
8
10{
11 private FileCollection $files;
12
13 public function __construct($files = null)
14 {
15 if (!$files instanceof FileCollection)
16 {
17 $this->files = new FileCollection();
18 }
19 else
20 {
21 $this->files = $files;
22 }
23
24 if ($files instanceof FileItem)
25 {
26 if ($this->files->getById($files->getId()) === null)
27 {
28 $this->files[] = $files;
29 }
30 }
31 }
32
33 public function merge(PopupDataItem $item): self
34 {
35 if ($item instanceof self)
36 {
37 foreach ($item->files as $file)
38 {
39 if ($this->files->getById($file->getId()) === null)
40 {
41 $this->files[] = $file;
42 }
43 }
44 }
45
46 return $this;
47 }
48
49 public static function getRestEntityName(): string
50 {
52 }
53
54 public function toRestFormat(array $option = []): array
55 {
56 return $this->files->getUnique()->toRestFormat($option);
57 }
58
59 public function getPopupData(array $excludedList = []): PopupData
60 {
61 return $this->files->getPopupData($excludedList);
62 }
63}