1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
search.php
См. документацию.
1<?php
2namespace Bitrix\Landing\Subtype;
3
4use \Bitrix\Landing\Landing;
5use \Bitrix\Landing\Block;
6
7class Search
8{
15 public static function getSearchResultPage($siteId, $tplCode)
16 {
17 $siteId = (int) $siteId;
18 $tplCode = (string) $tplCode;
19
21 'select' => [
22 'ID'
23 ],
24 'filter' => [
25 'SITE_ID' => $siteId,
26 '=TPL_CODE' => $tplCode
27 ]
28 ]);
29 if ($row = $res->fetch())
30 {
31 $landingId = $row['ID'];
32 }
33 else
34 {
36 $siteId,
37 $tplCode
38 );
39 $landingId = $res->getResult();
40 }
41
42 return $landingId;
43 }
44
51 protected static function prepareForm(array $manifest, array $params = [])
52 {
53 if (\Bitrix\Landing\Transfer\AppConfiguration::inProcess())
54 {
55 return $manifest;
56 }
57
58 // necessary params
59 if (!isset($params['resultPage']))
60 {
61 return $manifest;
62 }
63
64 // force set action attribute for form after block add
65 $manifest['callbacks'] = array(
66 'afterAdd' => function (Block &$block) use($params)
67 {
68 $manifest = $block->getManifest();
69 $landingId = Search::getSearchResultPage(
70 $block->getSiteId(),
71 $params['resultPage']
72 );
73
74 if (!$landingId)
75 {
76 return;
77 }
78
79 // try to find url attrs and set default value
80 $attributeSelector = '';
81 foreach ($manifest['attrs'] as $selector => $item)
82 {
83 if (
84 $item['type'] == 'url' &&
85 $item['attribute'] == 'action'
86 )
87 {
88 $attributeSelector = $selector;
89 break;
90 }
91 }
92
93 $block->setAttributes([
94 $attributeSelector => [
95 'action' => '#landing' . $landingId
96 ]
97 ]);
98 $block->save();
99 },
100 );
101
102 return $manifest;
103 }
104
112 public static function prepareManifest(array $manifest, Block $block = null, array $params = [])
113 {
114 if (!isset($params['type']))
115 {
116 return $manifest;
117 }
118
119 if ($params['type'] == 'form')
120 {
121 return self::prepareForm($manifest, $params);
122 }
123
124 return $manifest;
125 }
126}
save(array $additionalFields=[])
Определения block.php:2704
setAttributes($data)
Определения block.php:4593
getSiteId()
Определения block.php:1394
getManifest(bool $extended=false, bool $missCache=false, array $params=array())
Определения block.php:1682
static addByTemplate($siteId, $code, array $fields=[])
Определения landing.php:811
static prepareForm(array $manifest, array $params=[])
Определения search.php:51
static prepareManifest(array $manifest, Block $block=null, array $params=[])
Определения search.php:112
static getSearchResultPage($siteId, $tplCode)
Определения search.php:15
static getList(array $parameters=array())
Определения datamanager.php:431
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$res
Определения filter_act.php:7
$siteId
Определения ajax.php:8
Определения agent.php:3
Определения content.php:3
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']
Определения template.php:799