Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
fieldcollection.php
1
<?php
2
3
namespace
Bitrix\Location\Entity\Format
;
4
5
use
Bitrix\Main\ArgumentTypeException
;
6
use
Bitrix\Main\SystemException
;
7
13
final
class
FieldCollection
extends
\Bitrix\Location\Entity\Generic\FieldCollection
14
{
16
protected
$items
= [];
17
24
public
function
addItem
($field): int
25
{
26
if
(!($field instanceof
Field
))
27
{
28
throw
new
ArgumentTypeException
(
'field must be the instance of Field'
);
29
}
30
31
$result = parent::addItem($field);
32
33
/*
34
* Sort fields due to sort
35
* @todo: what about performance?
36
*/
37
usort(
38
$this->items,
39
function
(
Field
$a,
Field
$b)
40
{
41
if
($a->
getSort
() === $b->
getSort
())
42
{
43
return 0;
44
}
45
46
return ($a->
getSort
() < $b->
getSort
()) ? -1 : 1;
47
}
48
);
49
50
return
$result;
51
}
52
}
Bitrix\Location\Entity\Format\FieldCollection
Definition
fieldcollection.php:14
Bitrix\Location\Entity\Format\FieldCollection\addItem
addItem($field)
Definition
fieldcollection.php:24
Bitrix\Location\Entity\Format\FieldCollection\$items
$items
Definition
fieldcollection.php:16
Bitrix\Location\Entity\Format\Field
Definition
field.php:13
Bitrix\Location\Entity\Format\Field\getSort
getSort()
Definition
field.php:44
Bitrix\Location\Entity\Generic\FieldCollection
Definition
fieldcollection.php:13
Bitrix\Main\ArgumentTypeException
Definition
exception.php:114
Bitrix\Main\SystemException
Definition
exception.php:8
Bitrix\Location\Entity\Format
modules
location
lib
entity
format
fieldcollection.php
Создано системой
1.10.0