1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
IblockPropertyElementXmlProvider.php
См. документацию.
1<?php
2
3namespace Bitrix\Iblock\Integration\UI\EntitySelector;
4
5use Bitrix\UI\EntitySelector\Dialog;
6use Bitrix\UI\EntitySelector\Item;
7use Bitrix\UI\EntitySelector\SearchQuery;
8
10{
11 public const ENTITY_ID = 'iblock-property-element-xml';
12
20 public function doSearch(SearchQuery $searchQuery, Dialog $dialog): void
21 {
22 $filter = [];
23
24 $query = $searchQuery->getQuery();
25 if ($query !== '')
26 {
27 $filter = $this->getQueryFilter($query);
28 }
29
30 $elements = $this->getElements($filter, self::ELEMENTS_LIMIT);
31 if (count($elements) === self::ELEMENTS_LIMIT)
32 {
33 $searchQuery->setCacheable(false);
34 }
35 foreach ($elements as $element)
36 {
37 $dialog->addItem(
38 $this->makeItem($element)
39 );
40 }
41 }
42
43 private function getQueryFilter(string $query): array
44 {
45 return [
46 [
47 'LOGIC' => 'OR',
48 '%XML_ID' => $query,
49 '*SEARCHABLE_CONTENT' => $query,
50 ],
51 ];
52 }
53
54 protected function makeItem(array $element, string $propertyType = ''): Item
55 {
56 $itemParams = [
57 'id' => $element['ID'] ?? null,
58 'entityId' => self::ENTITY_ID,
59 'title' => $element['NAME'] ?? null,
60 'subtitle' => $element['XML_ID'] ?? null,
61 'description' => $element['DETAIL_TEXT'] ?? null,
62 'avatar' => $element['PREVIEW_PICTURE'] ?? null,
63 'customData' => [
64 'xmlId' => $element['XML_ID'] ?? null,
65 ],
66 ];
67
68 return new Item($itemParams);
69 }
70}
addItem(Item $item)
Определения dialog.php:126
setCacheable(bool $flag=true)
Определения searchquery.php:72
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$query
Определения get_search.php:11
$filter
Определения iblock_catalog_list.php:54
</p ></td >< td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 2.0pt 0cm 2.0pt;height:9.0pt'>< p class=Normal align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;line-height:normal'>< a name=ТекстовоеПоле54 ></a ><?=($taxRate > count( $arTaxList) > 0) ? $taxRate."%"
Определения waybill.php:936