1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
listfieldassembler.php
См. документацию.
1
<?php
2
3
namespace
Bitrix\Iblock\Grid\Row\Assembler\Property;
4
5
use Bitrix\Main;
6
use Bitrix\Iblock\Grid\Column\ElementPropertyProvider;
7
use Bitrix\Iblock\PropertyEnumerationTable;
8
use Bitrix\Iblock\PropertyTable;
9
10
final
class
ListFieldAssembler
extends
BaseFieldAssembler
11
{
12
public
function
__construct
(
int
$iblockId
)
13
{
14
parent::__construct(
$iblockId
, []);
15
}
16
17
protected
function
getPropertyFilter
():
array
18
{
19
return
[
20
'=PROPERTY_TYPE'
=>
PropertyTable::TYPE_LIST
,
21
'=USER_TYPE'
=>
null
,
22
];
23
}
24
25
protected
function
validateProperty
(
array
$property): ?
array
26
{
27
return
$property;
28
}
29
30
protected
function
prepareRow
(
array
$row):
array
31
{
32
if
(!self::isElementRow($row))
33
{
34
return
$row;
35
}
36
37
$columnIds = $this->
getColumnIds
();
38
if
(empty($columnIds))
39
{
40
return
$row;
41
}
42
43
$row[
'columns'
] ??= [];
44
45
$columnToPropertyIds = ElementPropertyProvider::getPropertyIdsFromColumnsIds($columnIds);
46
foreach
($columnToPropertyIds as $columnId => $propertyId)
47
{
48
// edit
49
$value = $this->
getColumnValues
($row[
'data'
][$columnId] ??
null
,
'VALUE_ENUM_ID'
);
50
Main\Type\Collection::normalizeArrayValuesByInt
($value,
false
);
51
if
($this->
isMultipleColumn
($columnId))
52
{
53
$row[
'data'
][
'~'
. $columnId] = $value;
54
}
55
else
56
{
57
$row[
'data'
][
'~'
. $columnId] = empty($value) ?
''
: reset($value);
58
}
59
60
// view
61
$value = $this->
getColumnValues
($row[
'data'
][$columnId] ??
null
,
'VALUE'
);
62
$viewValue =
''
;
63
if
(!empty($value))
64
{
65
$viewValue = join(
' / '
, $value);
66
}
67
$viewValue =
Main\Text\HtmlFilter::encode
($viewValue);
68
$row[
'columns'
][$columnId] ??= $viewValue;
69
}
70
71
/*
72
$columnToPropertyIds = ElementPropertyProvider::getPropertyIdsFromColumnsIds($columnIds);
73
foreach ($columnToPropertyIds as $columnId => $propertyId)
74
{
75
if (isset($row['columns'][$columnId]))
76
{
77
continue;
78
}
79
80
$value = $row['data'][$columnId] ?? null;
81
if (is_array($value))
82
{
83
$tmp = [];
84
foreach ($value as $valueItem)
85
{
86
if (is_numeric($valueItem))
87
{
88
$tmp[] = $this->getEnumValue($propertyId, $valueItem);
89
}
90
else
91
{
92
$tmp[] = $valueItem;
93
}
94
95
}
96
97
$value = join(' / ', $tmp);
98
}
99
elseif (is_numeric($value))
100
{
101
$value = $this->getEnumValue($propertyId, $value);
102
}
103
104
$row['columns'][$columnId] = $value;
105
}
106
107
*/
108
109
return
$row;
110
}
111
}
Bitrix\Iblock\Grid\Row\Assembler\Property\BaseFieldAssembler
Определения
basefieldassembler.php:13
Bitrix\Iblock\Grid\Row\Assembler\Property\BaseFieldAssembler\isMultipleColumn
isMultipleColumn(string $columnId)
Определения
basefieldassembler.php:116
Bitrix\Iblock\Grid\Row\Assembler\Property\BaseFieldAssembler\$iblockId
int $iblockId
Определения
basefieldassembler.php:17
Bitrix\Iblock\Grid\Row\Assembler\Property\BaseFieldAssembler\getColumnValues
getColumnValues(mixed $rawValues, string $fieldName='VALUE')
Определения
basefieldassembler.php:128
Bitrix\Iblock\Grid\Row\Assembler\Property\ListFieldAssembler
Определения
listfieldassembler.php:11
Bitrix\Iblock\Grid\Row\Assembler\Property\ListFieldAssembler\getPropertyFilter
getPropertyFilter()
Определения
listfieldassembler.php:17
Bitrix\Iblock\Grid\Row\Assembler\Property\ListFieldAssembler\__construct
__construct(int $iblockId)
Определения
listfieldassembler.php:12
Bitrix\Iblock\Grid\Row\Assembler\Property\ListFieldAssembler\prepareRow
prepareRow(array $row)
Определения
listfieldassembler.php:30
Bitrix\Iblock\Grid\Row\Assembler\Property\ListFieldAssembler\validateProperty
validateProperty(array $property)
Определения
listfieldassembler.php:25
Bitrix\Iblock\PropertyTable\TYPE_LIST
const TYPE_LIST
Определения
propertytable.php:70
Bitrix\Main\Grid\Row\FieldAssembler\getColumnIds
getColumnIds()
Определения
fieldassembler.php:47
Bitrix\Main\Text\HtmlFilter\encode
static encode($string, $flags=ENT_COMPAT, $doubleEncode=true)
Определения
htmlfilter.php:12
Bitrix\Main\Type\Collection\normalizeArrayValuesByInt
static normalizeArrayValuesByInt(&$map, $sorted=true)
Определения
collection.php:150
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
bitrix
modules
iblock
lib
grid
row
assembler
property
listfieldassembler.php
Создано системой
1.14.0