Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
IblockElementXmlProvider.php
1
<?php
2
3
namespace
Bitrix\Catalog\v2\Integration\UI\EntitySelector
;
4
5
use
Bitrix\UI\EntitySelector\Dialog
;
6
use
Bitrix\UI\EntitySelector\Item
;
7
use
Bitrix\UI\EntitySelector\SearchQuery
;
8
9
class
IblockElementXmlProvider
extends
IblockElementProvider
10
{
11
protected
const
ENTITY_ID
=
'iblock-element-xml'
;
12
13
public
function
doSearch
(
SearchQuery
$searchQuery,
Dialog
$dialog): void
14
{
15
$filter = [];
16
17
$query = $searchQuery->
getQuery
();
18
if
($query !==
''
)
19
{
20
$filter = $this->getQueryFilter($query);
21
}
22
23
$elements = $this->
getElements
($filter);
24
foreach
($elements as $element)
25
{
26
$dialog->
addItem
(
27
$this->
makeItem
($element)
28
);
29
}
30
}
31
32
private
function
getQueryFilter(
string
$query): array
33
{
34
return
[
35
[
36
'LOGIC'
=>
'OR'
,
37
'%XML_ID'
=> $query,
38
'*SEARCHABLE_CONTENT'
=> $query,
39
],
40
];
41
}
42
43
protected
function
makeItem
(array $element,
string
$propertyType =
''
):
Item
44
{
45
$itemParams = [
46
'id'
=> $element[
'ID'
] ??
null
,
47
'entityId'
=>
self::ENTITY_ID
,
48
'title'
=> $element[
'NAME'
] ??
null
,
49
'subtitle'
=> $element[
'XML_ID'
] ??
null
,
50
'description'
=> $element[
'DETAIL_TEXT'
] ??
null
,
51
'avatar'
=> $element[
'PREVIEW_PICTURE'
] ??
null
,
52
'customData'
=> [
53
'xmlId'
=> $element[
'XML_ID'
] ??
null
,
54
],
55
];
56
57
return
new
Item
($itemParams);
58
}
59
}
Bitrix\Catalog\v2\Integration\UI\EntitySelector\IblockElementProvider
Definition
IblockElementProvider.php:13
Bitrix\Catalog\v2\Integration\UI\EntitySelector\IblockElementProvider\getElements
getElements(array $additionalFilter=[])
Definition
IblockElementProvider.php:98
Bitrix\Catalog\v2\Integration\UI\EntitySelector\IblockElementXmlProvider
Definition
IblockElementXmlProvider.php:10
Bitrix\Catalog\v2\Integration\UI\EntitySelector\IblockElementXmlProvider\ENTITY_ID
const ENTITY_ID
Definition
IblockElementXmlProvider.php:11
Bitrix\Catalog\v2\Integration\UI\EntitySelector\IblockElementXmlProvider\makeItem
makeItem(array $element, string $propertyType='')
Definition
IblockElementXmlProvider.php:43
Bitrix\Catalog\v2\Integration\UI\EntitySelector\IblockElementXmlProvider\doSearch
doSearch(SearchQuery $searchQuery, Dialog $dialog)
Definition
IblockElementXmlProvider.php:13
Bitrix\UI\EntitySelector\Dialog
Definition
dialog.php:10
Bitrix\UI\EntitySelector\Dialog\addItem
addItem(Item $item)
Definition
dialog.php:112
Bitrix\UI\EntitySelector\Item
Definition
item.php:8
Bitrix\UI\EntitySelector\SearchQuery
Definition
searchquery.php:5
Bitrix\UI\EntitySelector\SearchQuery\getQuery
getQuery()
Definition
searchquery.php:40
Bitrix\Catalog\v2\Integration\UI\EntitySelector
modules
catalog
lib
v2
Integration
UI
EntitySelector
IblockElementXmlProvider.php
Создано системой
1.10.0