Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
elementdataprovider.php
1
<?php
2
3
namespace
Bitrix\Iblock\Filter\DataProvider
;
4
5
use
Bitrix\Iblock\Filter\DataProvider\Element\ElementFilterFields
;
6
use
Bitrix\Iblock\Filter\DataProvider\Settings\ElementSettings
;
7
use
Bitrix\Main\Filter\EntityDataProvider
;
8
use
Bitrix\Main\Localization\Loc
;
9
10
class
ElementDataProvider
extends
EntityDataProvider
11
{
12
private
ElementSettings
$settings;
13
private
ElementFilterFields
$fields;
14
15
public
function
__construct
(
ElementSettings
$settings)
16
{
17
$this->settings = $settings;
18
$this->fields = ElementFilterFields::createFromElementSettings($settings);
19
}
20
21
public
function
getSettings
():
ElementSettings
22
{
23
return
$this->settings;
24
}
25
26
public
function
prepareFields
()
27
{
28
$result = [];
29
30
$fields = $this->fields->
getElementFieldsParams
();
31
foreach
($fields as $id => $params)
32
{
33
$result[$id] = $this->
createField
($id, $params);
34
}
35
36
$properties = $this->fields->getElementPropertiesParams();
37
foreach
($properties as $id => $params)
38
{
39
$result[$id] = $this->
createField
($id, $params);
40
}
41
42
return
$result;
43
}
44
45
public
function
prepareFieldData
($fieldID)
46
{
47
if
($fieldID ===
'SECTION_ID'
)
48
{
49
return
[
50
'items'
=> $this->fields->getSectionListItems(),
51
];
52
}
53
elseif ($fieldID ===
'CREATED_BY'
|| $fieldID ===
'MODIFIED_BY'
)
54
{
55
return
$this->
getUserEntitySelectorParams
($fieldID .
'_filter'
, [
'fieldName'
=> $fieldID]);
56
}
57
elseif ($this->fields->isPropertyId($fieldID))
58
{
59
return
$this->fields->getPropertyDescription($fieldID);
60
}
61
62
return
null
;
63
}
64
65
protected
function
getFieldName
($fieldID)
66
{
67
return
Loc::getMessage
(
'IBLOCK_FILTER_ELEMENT_DATAPROVIDER_FIELD_'
. $fieldID) ?? $fieldID;
68
}
69
73
public
function
prepareFilterValue
(array $rawFilterValue): array
74
{
75
$rawFilterValue = parent::prepareFilterValue($rawFilterValue);
76
77
if
(!empty($rawFilterValue[
'FIND'
]))
78
{
79
$rawFilterValue[
'?NAME'
] = $rawFilterValue[
'FIND'
];
80
}
81
82
return
$this->fields->prepareFilterValue($rawFilterValue);
83
}
84
}
Bitrix\Iblock\Filter\DataProvider\Element\ElementFilterFields
Definition
elementfilterfields.php:12
Bitrix\Iblock\Filter\DataProvider\Element\ElementFilterFields\getElementFieldsParams
getElementFieldsParams()
Definition
elementfilterfields.php:38
Bitrix\Iblock\Filter\DataProvider\ElementDataProvider
Definition
elementdataprovider.php:11
Bitrix\Iblock\Filter\DataProvider\ElementDataProvider\prepareFieldData
prepareFieldData($fieldID)
Definition
elementdataprovider.php:45
Bitrix\Iblock\Filter\DataProvider\ElementDataProvider\prepareFilterValue
prepareFilterValue(array $rawFilterValue)
Definition
elementdataprovider.php:73
Bitrix\Iblock\Filter\DataProvider\ElementDataProvider\getFieldName
getFieldName($fieldID)
Definition
elementdataprovider.php:65
Bitrix\Iblock\Filter\DataProvider\ElementDataProvider\__construct
__construct(ElementSettings $settings)
Definition
elementdataprovider.php:15
Bitrix\Iblock\Filter\DataProvider\ElementDataProvider\getSettings
getSettings()
Definition
elementdataprovider.php:21
Bitrix\Iblock\Filter\DataProvider\ElementDataProvider\prepareFields
prepareFields()
Definition
elementdataprovider.php:26
Bitrix\Iblock\Filter\DataProvider\Settings\ElementSettings
Definition
elementsettings.php:9
Bitrix\Main\Filter\EntityDataProvider
Definition
entitydataprovider.php:7
Bitrix\Main\Filter\EntityDataProvider\getUserEntitySelectorParams
getUserEntitySelectorParams(string $context, array $params)
Definition
entitydataprovider.php:40
Bitrix\Main\Filter\EntityDataProvider\createField
createField($fieldID, array $params=null)
Definition
entitydataprovider.php:25
Bitrix\Main\Localization\Loc
Definition
loc.php:11
Bitrix\Main\Localization\Loc\getMessage
static getMessage($code, $replace=null, $language=null)
Definition
loc.php:29
Bitrix\Iblock\Filter\DataProvider
modules
iblock
lib
filter
dataprovider
elementdataprovider.php
Создано системой
1.10.0