1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
prefixabledataprovidertrait.php
См. документацию.
1
<?php
2
3
namespace
Bitrix\Catalog\Filter;
4
5
use Bitrix\Main\Filter\Field;
6
16
trait PrefixableDataProviderTrait
17
{
28
protected
function
splitPrefixFilterValues(
string
$prefix,
array
$fields
):
array
29
{
30
$otherFields = [];
31
$prefixFields = [];
32
33
foreach
(
$fields
as $nameWithPrefix =>
$value
)
34
{
35
$name
= $this->removePrefix($prefix, $nameWithPrefix);
36
37
if
(
$name
=== $nameWithPrefix)
38
{
39
$otherFields[
$name
] =
$value
;
40
}
41
else
42
{
43
$prefixFields[
$name
] =
$value
;
44
}
45
}
46
47
return
[$prefixFields, $otherFields];
48
}
49
50
protected
function
removePrefix(
string
$prefix,
string
$fieldId): string
51
{
52
return
str_replace
($prefix,
''
, $fieldId);
53
}
54
55
protected
function
addPrefix(
string
$prefix,
string
$fieldId): string
56
{
57
return
$prefix . $fieldId;
58
}
59
68
protected
function
appendPrefixName(
string
$prefixNameTemplate,
string
$fieldName): string
69
{
70
return
str_replace
(
'#NAME#'
, $fieldName, $prefixNameTemplate);
71
}
72
84
protected
function
prepareFieldsByPrefix(
string
$prefix,
array
$fields
, ?
string
$prefixNameTemplate =
null
, ?
array
$iconParams
=
null
, ?
string
$sectionId
=
null
):
array
85
{
86
$result
= [];
87
88
foreach
(
$fields
as
$id
=>
$field
)
89
{
90
if
(
$field
instanceof
Field
)
91
{
92
$newId = $this->addPrefix($prefix,
$id
);
93
$field
->setID($newId);
94
95
$name
=
$field
->getName();
96
if
(
$name
)
97
{
98
if
(isset($prefixNameTemplate))
99
{
100
$name
= $this->appendPrefixName($prefixNameTemplate,
$name
);
101
}
102
103
$field
->setName(
$name
);
104
}
105
106
if
(isset(
$iconParams
))
107
{
108
$field
->setIconParams(
$iconParams
);
109
}
110
111
if
(isset(
$sectionId
))
112
{
113
$field
->setSectionId(
$sectionId
);
114
}
115
116
$result
[$newId] =
$field
;
117
}
118
}
119
120
return
$result
;
121
}
122
}
Bitrix\Main\Filter\Field
Определения
field.php:5
Bitrix\Main\Filter\Field\$iconParams
$iconParams
Определения
field.php:22
Bitrix\Main\Filter\Field\$name
$name
Определения
field.php:11
Bitrix\Main\Filter\Field\$sectionId
$sectionId
Определения
field.php:21
Bitrix\Main\Filter\Field\$id
$id
Определения
field.php:9
Bitrix\Main\ORM\Entity\$fields
$fields
Определения
entity.php:45
Bitrix\Main\ORM\Fields\FieldError\$field
$field
Определения
fielderror.php:19
Bitrix\Main\Text\StringHelper\str_replace
static str_replace($search, $replace, $str)
Определения
stringhelper.php:74
Bitrix\Main\Type\Date\$value
$value
Определения
date.php:11
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
$result
$result
Определения
get_property_values.php:14
bitrix
modules
catalog
lib
filter
prefixabledataprovidertrait.php
Создано системой
1.14.0