1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
fieldcollection.php
См. документацию.
1<?php
2
3namespace Bitrix\Location\Entity\Generic;
4
5use Bitrix\Main\SystemException;
6
12abstract class FieldCollection extends Collection
13{
15 protected $items = [];
16
21 public function isItemExist(int $type): bool
22 {
23 foreach($this->items as $item)
24 {
25 if($item->getType() === $type)
26 {
27 return true;
28 }
29 }
30
31 return false;
32 }
33
38 public function getItemByType(int $type): ?IField
39 {
40 foreach($this->items as $item)
41 {
42 if($item->getType() === $type)
43 {
44 return $item;
45 }
46 }
47
48 return null;
49 }
50
54 public function getSortedItems(): array
55 {
57
58 uasort(
59 $result,
60 function ($a, $b)
61 {
62 if ($a->getType() == $b->getType())
63 {
64 return 0;
65 }
66 return ($a->getType() < $b->getType()) ? -1 : 1;
67 }
68 );
69
70 return $result;
71 }
72
78 public function addItem($item): int
79 {
80 if($this->isItemExist($item->getType()))
81 {
82 throw new SystemException('Item with type "'.$item->getType().'" already exist in this collection');
83 }
84
85 return parent::addItem($item);
86 }
87}
$type
Определения options.php:106
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$result
Определения get_property_values.php:14
else $a
Определения template.php:137