Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
IblockPropertyElementXmlProvider.php
1
<?php
2
3
namespace
Bitrix\Iblock\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
IblockPropertyElementXmlProvider
extends
IblockPropertyElementProvider
10
{
11
protected
const
ENTITY_ID
=
'iblock-property-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, self::ELEMENTS_LIMIT);
24
if
(count($elements) === self::ELEMENTS_LIMIT)
25
{
26
$searchQuery->
setCacheable
(
false
);
27
}
28
foreach
($elements as $element)
29
{
30
$dialog->
addItem
(
31
$this->
makeItem
($element)
32
);
33
}
34
}
35
36
private
function
getQueryFilter(
string
$query): array
37
{
38
return
[
39
[
40
'LOGIC'
=>
'OR'
,
41
'%XML_ID'
=> $query,
42
'*SEARCHABLE_CONTENT'
=> $query,
43
],
44
];
45
}
46
47
protected
function
makeItem
(array $element,
string
$propertyType =
''
):
Item
48
{
49
$itemParams = [
50
'id'
=> $element[
'ID'
] ??
null
,
51
'entityId'
=>
self::ENTITY_ID
,
52
'title'
=> $element[
'NAME'
] ??
null
,
53
'subtitle'
=> $element[
'XML_ID'
] ??
null
,
54
'description'
=> $element[
'DETAIL_TEXT'
] ??
null
,
55
'avatar'
=> $element[
'PREVIEW_PICTURE'
] ??
null
,
56
'customData'
=> [
57
'xmlId'
=> $element[
'XML_ID'
] ??
null
,
58
],
59
];
60
61
return
new
Item
($itemParams);
62
}
63
}
Bitrix\Iblock\Integration\UI\EntitySelector\IblockPropertyElementProvider
Definition
IblockPropertyElementProvider.php:13
Bitrix\Iblock\Integration\UI\EntitySelector\IblockPropertyElementProvider\getElements
getElements(array $additionalFilter=[], ?int $limit=null)
Definition
IblockPropertyElementProvider.php:103
Bitrix\Iblock\Integration\UI\EntitySelector\IblockPropertyElementXmlProvider
Definition
IblockPropertyElementXmlProvider.php:10
Bitrix\Iblock\Integration\UI\EntitySelector\IblockPropertyElementXmlProvider\ENTITY_ID
const ENTITY_ID
Definition
IblockPropertyElementXmlProvider.php:11
Bitrix\Iblock\Integration\UI\EntitySelector\IblockPropertyElementXmlProvider\makeItem
makeItem(array $element, string $propertyType='')
Definition
IblockPropertyElementXmlProvider.php:47
Bitrix\Iblock\Integration\UI\EntitySelector\IblockPropertyElementXmlProvider\doSearch
doSearch(SearchQuery $searchQuery, Dialog $dialog)
Definition
IblockPropertyElementXmlProvider.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\UI\EntitySelector\SearchQuery\setCacheable
setCacheable(bool $flag=true)
Definition
searchquery.php:72
Bitrix\Iblock\Integration\UI\EntitySelector
Definition
BaseUserFieldProvider.php:3
modules
iblock
lib
Integration
UI
EntitySelector
IblockPropertyElementXmlProvider.php
Создано системой
1.10.0