1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
MorePhotoImage.php
См. документацию.
1<?php
2
3namespace Bitrix\Catalog\v2\Image;
4
5use Bitrix\Catalog\v2\BaseEntity;
6use Bitrix\Catalog\v2\BaseIblockElementEntity;
7
17{
18 public const CODE = 'MORE_PHOTO';
19
20 public function setFileStructure(array $fileFields): BaseImage
21 {
22 parent::setFileStructure($fileFields);
23
25 if ($parent = $this->getParent())
26 {
27 $property = $parent->getPropertyCollection()->findByCodeLazy(self::CODE);
28 if ($property)
29 {
31 $item = $property->getPropertyValueCollection()->findByValue($this->getId());
32
33 if ($item)
34 {
35 $item->setValue($this->getFileStructure());
36 }
37 else
38 {
39 if ($property->isMultiple())
40 {
41 $values = $property->getPropertyValueCollection()->getValues();
42 $values[] = $this->getFileStructure();
43 }
44 else
45 {
46 $values = [
47 $this->getFileStructure(),
48 ];
49 }
50 $property->getPropertyValueCollection()->setValues($values);
51 }
52 }
53 }
54
55 return $this;
56 }
57
58 public function remove(): BaseEntity
59 {
61 if ($parent = $this->getParent())
62 {
63 $property = $parent->getPropertyCollection()->findByCodeLazy(MorePhotoImage::CODE);
64 if ($property)
65 {
66 $valueCollection = $property->getPropertyValueCollection();
67
68 foreach ($valueCollection as $item)
69 {
70 if ((int)$item->getValue() === $this->getId())
71 {
72 $valueCollection->remove($item);
73 break;
74 }
75 }
76 }
77 }
78
79 return parent::remove();
80 }
81}
setFileStructure(array $fileFields)
Определения BaseImage.php:35
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804