Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
stringfieldassembler.php
1<?php
2
4
7
9{
10 protected function getPropertyFilter(): array
11 {
12 return [
13 '=PROPERTY_TYPE' => PropertyTable::TYPE_STRING,
14 '=USER_TYPE' => null,
15 ];
16 }
17
18 protected function validateProperty(array $property): ?array
19 {
20 return $property;
21 }
22
23 protected function prepareRow(array $row): array
24 {
25 if (!self::isElementRow($row))
26 {
27 return $row;
28 }
29
30 $columnIds = $this->getColumnIds();
31 if (empty($columnIds))
32 {
33 return $row;
34 }
35
36 $row['columns'] ??= [];
37
38 foreach ($columnIds as $columnId)
39 {
40 $value = $this->getFlatColumnValues($row['data'][$columnId] ?? null);
41
42 // edit
43 if ($value === null)
44 {
45 $row['data']['~' . $columnId] = $this->isMultipleColumn($columnId) ? [] : '';
46 }
47 else
48 {
49 $row['data']['~' . $columnId] = $value;
50 }
51
52 // view
53 if (is_array($value))
54 {
55 $value = implode(' / ', $value);
56 }
57 $value = Main\Text\HtmlFilter::encode((string)$value);
58 $row['columns'][$columnId] = $value;
59
60 unset($value);
61 }
62
63 return $row;
64 }
65}
static getFlatColumnValues(mixed $rawValues, $fieldName='VALUE')