2namespace Bitrix\Landing\PublicAction;
4use \Bitrix\Landing\Manager;
5use \Bitrix\Landing\Error;
6use \Bitrix\Landing\PublicActionResult;
7use \Bitrix\Main\Loader;
8use \Bitrix\Main\UrlPreview\UrlPreview;
45 $urlPreview->getMetadataByUrl(
$url)
51 $error->addError(
'EMPTY_URL',
'Empty URL');
72 \Bitrix\Landing\Hook::setEditMode(
true);
83 if (!Loader::includeModule(
'iblock'))
85 $publicResult->setResult([]);
96 array_map(
function($fragment) {
97 return [
'%NAME' => trim($fragment)];
98 }, explode(
' ', trim(
$query)))
104 $type === self::TYPE_CATALOG_ALL ||
105 $type === self::TYPE_CATALOG_ELEMENT)
111 'ID',
'NAME',
'IBLOCK_SECTION_ID',
'DETAIL_PICTURE'
114 $result = \CIBlockElement::getList(
117 while ($item =
$result->fetch())
120 static::makeCatalogEntityNavChain(
121 $item[
'IBLOCK_SECTION_ID'],
125 'name' => $item[
'NAME'],
127 'image' => \CFile::getPath($item[
'DETAIL_PICTURE']),
128 'type' => self::TYPE_CATALOG,
129 'subType' => self::TYPE_CATALOG_ELEMENT,
136 $type === self::TYPE_CATALOG_ALL ||
137 $type === self::TYPE_CATALOG_SECTION
142 'ID',
'NAME',
'IBLOCK_SECTION_ID',
'DETAIL_PICTURE'
150 while ($item = $sectResult->Fetch())
153 static::makeCatalogEntityNavChain(
154 $item[
'IBLOCK_SECTION_ID'],
158 'name' => trim($item[
'NAME']),
161 'type' => self::TYPE_CATALOG,
162 'subType' => self::TYPE_CATALOG_SECTION,
163 'chain' => !empty($chain) ? $chain : [
'/']
169 $publicResult->setResult(
$data);
171 return $publicResult;
183 if ($sectionId !==
null)
187 self::TYPE_CATALOG_SECTION
189 array_unshift($chain, $section[
'name']);
190 static::makeCatalogEntityNavChain(
191 $section[
'sectionId'],
208 if (Loader::includeModule(
'iblock'))
210 $isElement = $entityType == self::TYPE_CATALOG_ELEMENT;
213 $res = \CIBlockElement::getList(
217 'CHECK_PERMISSIONS' =>
'Y'
224 'ID',
'NAME',
'DETAIL_PICTURE',
'IBLOCK_SECTION_ID'
230 $res = \CIBlockSection::getList(
234 'CHECK_PERMISSIONS' =>
'Y'
238 'ID',
'NAME',
'IBLOCK_SECTION_ID'
248 static::makeCatalogEntityNavChain(
255 'sectionId' =>
$entity[
'IBLOCK_SECTION_ID'],
256 'image' => $isElement
257 ? \CFile::getPath(
$entity[
'DETAIL_PICTURE'])
259 'type' => self::TYPE_CATALOG,
260 'subType' => $entityType,
281 self::TYPE_CATALOG_ELEMENT
307 self::TYPE_CATALOG_SECTION
330 static $urls =
array();
333 $elementId = (int)$elementId;
334 $key = (string)$urlType .
'_' . $elementId;
336 if (isset($urls[
$key]))
341 if (!\
Bitrix\
Main\Loader::includeModule(
'iblock'))
348 \Bitrix\Landing\Hook::setEditMode(
true);
352 $urls[
$key] =
'#system_catalog';
356 if ($urlType ==
'detail' || $urlType ==
'element')
361 'ID',
'CODE',
'IBLOCK_SECTION_ID'
368 if (!($element =
$res->fetch()))
373 $urls[
$key] .=
'item/' . $element[
'CODE'] .
'/';
375 elseif ($urlType ==
'section')
377 $res = \CIBlockSection::getNavChain(
381 while ($row =
$res->fetch())
383 $urls[
$key] .= $row[
'CODE'] .
'/';
415 static $internal =
true;
419 $allowedKeys = [
'google_images_key'];
423 if (in_array(
$key, $allowedKeys))
439 static $internal =
true;
455 $whiteList = [
'color_field_recent_colors'];
458 if (in_array(
$name, $whiteList,
true))
460 $response->setResult(\CUserOptions::getOption(
'landing',
$name,
null));
465 $error->addError(
'WRONG_OPTION',
'Option name is not allowed');
static getDataForSite($id=null)
static checkMultiFeature(array $features, array $params=[])
static makeCatalogEntityNavChain($sectionId, array &$chain)
static getIblockURL($elementId, $urlType)
const TYPE_CATALOG_SECTION
static getCatalogElement($elementId)
static getCatalogSection($sectionId)
static checkMultiFeature(array $code, array $params=[])
static saveSettings(array $settings)
static getUrlPreview($url)
static catalogSearch($query=null, $type=self::TYPE_CATALOG_ALL, $iblock=null, $siteId=null)
const TYPE_CATALOG_ELEMENT
static getCatalogEntity($entityId, $entityType)
static getUserOption(string $name)
static set($moduleId, $name, $value="", $siteId="")
static getList(array $parameters=array())
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
if(! $catalogEdit->isSuccess()) $iblock
if(!is_null($config))($config as $configItem)(! $configItem->isVisible()) $code
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
if(empty($signedUserToken)) $key
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']