25 if (!is_array($params))
29 $params[
'ADD_SECTIONS_CHAIN'] = (isset($params[
'ADD_SECTIONS_CHAIN']) && $params[
'ADD_SECTIONS_CHAIN'] ===
'N' ?
'N' :
'Y');
30 $params[
'PRODUCT_DISPLAY_MODE'] =
'Y';
31 $params = parent::onPrepareComponentParams($params);
32 $params[
'IBLOCK_TYPE'] = trim((
string)($params[
'IBLOCK_TYPE'] ??
''));
34 if ((
int)$params[
'ELEMENT_ID'] > 0 && (
int)$params[
'ELEMENT_ID'] != $params[
'ELEMENT_ID'] && Loader::includeModule(
'iblock'))
36 $this->errorCollection->setError(
new Error(
Loc::getMessage(
'CATALOG_ELEMENT_NOT_FOUND'), self::ERROR_404));
41 $params[
'ELEMENT_ID'] = (int)$params[
'ELEMENT_ID'];
42 $params[
'ELEMENT_CODE'] = trim((
string)($params[
'ELEMENT_CODE'] ??
''));
44 $params[
'CHECK_SECTION_ID_VARIABLE'] = isset($params[
'CHECK_SECTION_ID_VARIABLE']) && $params[
'CHECK_SECTION_ID_VARIABLE'] ===
'Y' ?
'Y' :
'N';
45 $params[
'SECTION_ID_VARIABLE'] = trim((
string)($params[
'SECTION_ID_VARIABLE'] ??
''));
47 $params[
'SECTION_ID_VARIABLE'] ===
''
48 || !preg_match(self::PARAM_TITLE_MASK, $params[
'SECTION_ID_VARIABLE'])
51 $params[
'SECTION_ID_VARIABLE'] =
'SECTION_ID';
54 $params[
'FROM_SECTION'] =
'';
55 if ($params[
'CHECK_SECTION_ID_VARIABLE'] ===
'Y')
57 $params[
'FROM_SECTION'] = trim($this->request->get($params[
'SECTION_ID_VARIABLE']));
60 $params[
'SECTIONS_CHAIN_START_FROM'] = (int)($params[
'SECTIONS_CHAIN_START_FROM'] ?? 0);
61 $params[
'META_KEYWORDS'] = trim((
string)($params[
'META_KEYWORDS'] ??
''));
62 $params[
'META_DESCRIPTION'] = trim((
string)($params[
'META_DESCRIPTION'] ??
''));
63 $params[
'BROWSER_TITLE'] = trim((
string)($params[
'BROWSER_TITLE'] ??
''));
65 $params[
'BACKGROUND_IMAGE'] = trim((
string)($params[
'BACKGROUND_IMAGE'] ??
''));
66 if ($params[
'BACKGROUND_IMAGE'] ===
'-')
68 $params[
'BACKGROUND_IMAGE'] =
'';
71 $params[
'USE_MAIN_ELEMENT_SECTION'] = isset($params[
'USE_MAIN_ELEMENT_SECTION']) && $params[
'USE_MAIN_ELEMENT_SECTION'] ===
'Y';
72 $params[
'ADD_ELEMENT_CHAIN'] = isset($params[
'ADD_ELEMENT_CHAIN']) && $params[
'ADD_ELEMENT_CHAIN'] ===
'Y';
73 $params[
'LINK_IBLOCK_TYPE'] = trim((
string)($params[
'LINK_IBLOCK_TYPE'] ??
''));
74 $params[
'LINK_IBLOCK_ID'] = (int)($params[
'LINK_IBLOCK_ID'] ?? 0);
75 $params[
'LINK_PROPERTY_SID'] = trim((
string)($params[
'LINK_PROPERTY_SID'] ??
''));
76 $params[
'LINK_ELEMENTS_URL'] = trim((
string)($params[
'LINK_ELEMENTS_URL'] ??
''));
77 if ($params[
'LINK_ELEMENTS_URL'] ===
'')
79 $params[
'LINK_ELEMENTS_URL'] =
'link.php?PARENT_ELEMENT_ID=#ELEMENT_ID#';
82 $params[
'SHOW_WORKFLOW'] = $this->request->get(
'show_workflow') ===
'Y';
83 if ($params[
'SHOW_WORKFLOW'])
85 $params[
'CACHE_TIME'] = 0;
88 $params[
'PRICE_VAT_SHOW_VALUE'] = isset($params[
'PRICE_VAT_SHOW_VALUE']) && $params[
'PRICE_VAT_SHOW_VALUE'] ===
'Y';
91 if (!isset($params[
'HIDE_NOT_AVAILABLE_OFFERS']) && isset($params[
'HIDE_NOT_AVAILABLE']))
93 $params[
'HIDE_NOT_AVAILABLE_OFFERS'] = $params[
'HIDE_NOT_AVAILABLE'];
97 !isset($params[
'HIDE_NOT_AVAILABLE_OFFERS'])
98 || ($params[
'HIDE_NOT_AVAILABLE_OFFERS'] !==
'Y' && $params[
'HIDE_NOT_AVAILABLE_OFFERS'] !==
'L')
101 $params[
'HIDE_NOT_AVAILABLE_OFFERS'] =
'N';
104 $params[
'HIDE_NOT_AVAILABLE'] =
'N';
105 $params[
'USE_ELEMENT_COUNTER'] = isset($params[
'USE_ELEMENT_COUNTER']) && $params[
'USE_ELEMENT_COUNTER'] ===
'N' ?
'N' :
'Y';
106 $params[
'SHOW_DEACTIVATED'] = isset($params[
'SHOW_DEACTIVATED']) && $params[
'SHOW_DEACTIVATED'] ===
'Y' ?
'Y' :
'N';
109 if (empty($params[
'USE_GIFTS_DETAIL']))
111 $params[
'USE_GIFTS_DETAIL'] =
'Y';
114 if (empty($params[
'USE_GIFTS_MAIN_PR_SECTION_LIST']))
116 $params[
'USE_GIFTS_MAIN_PR_SECTION_LIST'] =
'Y';
119 if (empty($params[
'GIFTS_DETAIL_PAGE_ELEMENT_COUNT']))
121 $params[
'GIFTS_DETAIL_PAGE_ELEMENT_COUNT'] = 4;
124 if (empty($params[
'GIFTS_MAIN_PRODUCT_DETAIL_PAGE_ELEMENT_COUNT']))
126 $params[
'GIFTS_MAIN_PRODUCT_DETAIL_PAGE_ELEMENT_COUNT'] = 4;
136 $usePropertyFeatures = Iblock\Model\PropertyFeature::isEnabledFeatures();
138 if (!isset($params[
'PROPERTY_CODE']) || !is_array($params[
'PROPERTY_CODE']))
140 $params[
'PROPERTY_CODE'] = array();
143 foreach ($params[
'PROPERTY_CODE'] as $k => $v)
147 unset($params[
'PROPERTY_CODE'][$k]);
151 if (!isset($params[
'OFFERS_FIELD_CODE']))
153 $params[
'OFFERS_FIELD_CODE'] = array();
155 elseif (!is_array($params[
'OFFERS_FIELD_CODE']))
157 $params[
'OFFERS_FIELD_CODE'] = array($params[
'OFFERS_FIELD_CODE']);
160 foreach ($params[
'OFFERS_FIELD_CODE'] as $key => $value)
164 unset($params[
'OFFERS_FIELD_CODE'][$key]);
168 if (!isset($params[
'OFFERS_PROPERTY_CODE']))
170 $params[
'OFFERS_PROPERTY_CODE'] = array();
172 elseif (!is_array($params[
'OFFERS_PROPERTY_CODE']))
174 $params[
'OFFERS_PROPERTY_CODE'] = array($params[
'OFFERS_PROPERTY_CODE']);
177 foreach ($params[
'OFFERS_PROPERTY_CODE'] as $key => $value)
181 unset($params[
'OFFERS_PROPERTY_CODE'][$key]);
185 if (!in_array(
'PREVIEW_PICTURE', $params[
'OFFERS_PROPERTY_CODE']))
187 $params[
'OFFERS_PROPERTY_CODE'][] =
'PREVIEW_PICTURE';
190 if (!in_array(
'DETAIL_PICTURE', $params[
'OFFERS_PROPERTY_CODE']))
192 $params[
'OFFERS_PROPERTY_CODE'][] =
'DETAIL_PICTURE';
195 $cartProperties = [];
196 $offersCartProperties = [];
197 $offerTreeProperties = [];
198 if (!$usePropertyFeatures)
200 if (!isset($params[
'PRODUCT_PROPERTIES']) || !is_array($params[
'PRODUCT_PROPERTIES']))
202 $params[
'PRODUCT_PROPERTIES'] = array();
205 foreach ($params[
'PRODUCT_PROPERTIES'] as $k => $v)
209 unset($params[
'PRODUCT_PROPERTIES'][$k]);
212 $cartProperties = $params[
'PRODUCT_PROPERTIES'];
214 if (!isset($params[
'OFFERS_CART_PROPERTIES']) || !is_array($params[
'OFFERS_CART_PROPERTIES']))
216 $params[
'OFFERS_CART_PROPERTIES'] = array();
219 foreach ($params[
'OFFERS_CART_PROPERTIES'] as $i => $pid)
223 unset($params[
'OFFERS_CART_PROPERTIES'][$i]);
226 $offersCartProperties = $params[
'OFFERS_CART_PROPERTIES'];
228 if (!isset($params[
'OFFER_TREE_PROPS']))
230 $params[
'OFFER_TREE_PROPS'] = array();
232 elseif (!is_array($params[
'OFFER_TREE_PROPS']))
234 $params[
'OFFER_TREE_PROPS'] = array($params[
'OFFER_TREE_PROPS']);
237 foreach ($params[
'OFFER_TREE_PROPS'] as $key => $value)
239 $value = (string)$value;
240 if ($value ==
'' || $value ===
'-')
242 unset($params[
'OFFER_TREE_PROPS'][$key]);
246 if (empty($params[
'OFFER_TREE_PROPS']) && !empty($params[
'OFFERS_CART_PROPERTIES']))
248 $params[
'OFFER_TREE_PROPS'] = $params[
'OFFERS_CART_PROPERTIES'];
249 foreach ($params[
'OFFER_TREE_PROPS'] as $key => $value)
253 unset($params[
'OFFER_TREE_PROPS'][$key]);
257 $offerTreeProperties = $params[
'OFFER_TREE_PROPS'];
261 $params[
'IBLOCK_ID'] => array(
262 'PROPERTY_CODE' => $params[
'PROPERTY_CODE'],
263 'CART_PROPERTIES' => $cartProperties,
264 'OFFERS_FIELD_CODE' => $params[
'OFFERS_FIELD_CODE'],
265 'OFFERS_PROPERTY_CODE' => $params[
'OFFERS_PROPERTY_CODE'],
266 'OFFERS_CART_PROPERTIES' => $offersCartProperties,
267 'OFFERS_TREE_PROPS' => $offerTreeProperties
352 parent::initCatalogInfo();
353 $useCatalogButtons = array();
356 !empty($this->storage[
'CATALOGS'][$this->arParams[
'IBLOCK_ID']])
357 && is_array($this->storage[
'CATALOGS'][$this->arParams[
'IBLOCK_ID']])
360 $catalogType = $this->storage[
'CATALOGS'][$this->arParams[
'IBLOCK_ID']][
'CATALOG_TYPE'];
361 if ($catalogType == \CCatalogSku::TYPE_CATALOG || $catalogType == \CCatalogSku::TYPE_FULL)
363 $useCatalogButtons[
'add_product'] =
true;
366 if ($catalogType == \CCatalogSku::TYPE_PRODUCT || $catalogType == \CCatalogSku::TYPE_FULL)
368 $useCatalogButtons[
'add_sku'] =
true;
373 $this->arResult[
'USE_CATALOG_BUTTONS'] = $useCatalogButtons;
449 $wfShowHistory =
'N';
451 if ($this->arParams[
'SHOW_WORKFLOW'] && Loader::includeModule(
'workflow'))
453 $this->storage[
'modules'][
'workflow'] =
true;
455 $wfElementId = \CIBlockElement::WF_GetLast($this->arParams[
'ELEMENT_ID']);
456 $wfStatusId = \CIBlockElement::WF_GetCurrentStatus($wfElementId, $wfStatusTitle);
457 $wfStatusPermission = \CIBlockElement::WF_GetStatusPermission($wfStatusId);
459 if ($wfStatusId == 1 || $wfStatusPermission < 1)
461 $wfElementId = $this->arParams[
'ELEMENT_ID'];
465 $wfShowHistory =
'Y';
468 $this->arParams[
'ELEMENT_ID'] = $wfElementId;
471 return $wfShowHistory;
478 if ($this->arParams[
'STRICT_SECTION_CHECK'])
480 $sectionId = !empty($section) ? $section[
'ID'] : 0;
482 if ($this->arParams[
'USE_MAIN_ELEMENT_SECTION'])
484 $this->filterFields[
'IBLOCK_SECTION_ID'] = $sectionId;
488 $this->filterFields[
'SECTION_ID'] = $sectionId;
489 $this->filterFields[
'INCLUDE_SUBSECTIONS'] =
'N';
493 $elementIterator = parent::getElementList($iblockId, $products);
495 if (!empty($elementIterator) && !$this->arParams[
'USE_MAIN_ELEMENT_SECTION'])
497 $elementIterator->SetSectionContext($section);
500 $this->storage[
'SECTION'] = $section;
502 return $elementIterator;
508 $sectionFilter = array(
509 'IBLOCK_ID' => $this->arParams[
'IBLOCK_ID'],
513 if ($this->arParams[
'SECTION_ID'] > 0 || $this->arParams[
'SECTION_CODE'] !==
'')
515 if ($this->arParams[
'SECTION_ID'] > 0)
517 $sectionFilter[
'ID'] = $this->arParams[
'SECTION_ID'];
521 $sectionFilter[
'HAS_ELEMENT'] = $this->arParams[
'ELEMENT_ID'];
522 $sectionFilter[
'=CODE'] = $this->arParams[
'SECTION_CODE'];
525 $sectionIterator = \CIBlockSection::GetList(array(), $sectionFilter);
526 $sectionIterator->SetUrlTemplates(
'', $this->arParams[
'SECTION_URL']);
527 $section = $sectionIterator->GetNext();
529 elseif ($this->arParams[
'CHECK_SECTION_ID_VARIABLE'] ===
'Y' && $this->arParams[
'FROM_SECTION'] !==
'')
531 if ((
int)$this->arParams[
'FROM_SECTION'].
'|' == $this->arParams[
'FROM_SECTION'].
'|')
533 $sectionFilter[
'ID'] = $this->arParams[
'FROM_SECTION'];
537 $sectionFilter[
'HAS_ELEMENT'] = $this->arParams[
'ELEMENT_ID'];
538 $sectionFilter[
'=CODE'] = $this->arParams[
'FROM_SECTION'];
541 $sectionIterator = \CIBlockSection::GetList(array(), $sectionFilter);
542 $sectionIterator->SetUrlTemplates(
'', $this->arParams[
'SECTION_URL']);
543 $section = $sectionIterator->GetNext();
571 if (!empty($iblockElements))
573 reset($iblockElements);
574 $elementKey = key($iblockElements);
575 $element =& $iblockElements[$elementKey];
577 $iblockParams = $this->storage[
'IBLOCK_PARAMS'][$iblock];
579 'ID' => array_keys($iblockElements),
580 'IBLOCK_ID' => $iblock
582 \CIBlockElement::GetPropertyValuesArray($iblockElements, $iblock, $propFilter);
584 if (!empty($iblockParams[
'PROPERTY_CODE']))
586 $propertyList = $this->getPropertyList($iblock, $iblockParams[
'PROPERTY_CODE']);
589 if ($this->useCatalog && $this->useDiscountCache)
591 if ($this->storage[
'USE_SALE_DISCOUNTS'])
592 Catalog\Discount\DiscountManager::setProductPropertiesCache($element[
'ID'], $element[
"PROPERTIES"]);
594 \CCatalogDiscount::SetProductPropertiesCache($element[
'ID'], $element[
'PROPERTIES']);
597 if (!empty($propertyList))
599 foreach ($propertyList as $pid)
601 if (!isset($element[
'PROPERTIES'][$pid]))
604 $prop =& $element[
'PROPERTIES'][$pid];
605 $isArr = is_array($prop[
'VALUE']);
607 ($isArr && !empty($prop[
'VALUE']))
608 || (!$isArr && (
string)$prop[
'VALUE'] !==
'')
612 $element[
'DISPLAY_PROPERTIES'][$pid] = \CIBlockFormatProperties::GetDisplayValue($element, $prop);
618 \CIBlockFormatProperties::clearCache();
622 if ($this->arParams[
'ADD_PROPERTIES_TO_BASKET'] ===
'Y' && !empty($iblockParams[
'CART_PROPERTIES']))
624 $element[
'PRODUCT_PROPERTIES'] = \CIBlockPriceTools::GetProductProperties(
627 $iblockParams[
'CART_PROPERTIES'],
628 $element[
'PROPERTIES']
631 if (!empty($element[
'PRODUCT_PROPERTIES']))
633 $element[
'PRODUCT_PROPERTIES_FILL'] = \CIBlockPriceTools::getFillProductProperties($element[
'PRODUCT_PROPERTIES']);
637 $element[
'BACKGROUND_IMAGE'] =
false;
639 if ($this->arParams[
'BACKGROUND_IMAGE'] !=
'' && isset($element[
'PROPERTIES'][$this->arParams[
'BACKGROUND_IMAGE']]))
641 if (!empty($element[
'PROPERTIES'][$this->arParams[
'BACKGROUND_IMAGE']][
'VALUE']))
643 $element[
'BACKGROUND_IMAGE'] = \CFile::GetFileArray($element[
'PROPERTIES'][$this->arParams[
'BACKGROUND_IMAGE']][
'VALUE']);
647 $element[
'MORE_PHOTO'] = array();
649 if (!empty($element[
'PROPERTIES'][
'MORE_PHOTO'][
'VALUE']) && is_array($element[
'PROPERTIES'][
'MORE_PHOTO'][
'VALUE']))
651 foreach ($element[
'PROPERTIES'][
'MORE_PHOTO'][
'VALUE'] as $file)
653 $file = \CFile::GetFileArray($file);
656 $element[
'MORE_PHOTO'][] = $file;
661 $element[
'LINKED_ELEMENTS'] = array();
664 $this->arParams[
'LINK_PROPERTY_SID'] <>
''
665 && $this->arParams[
'LINK_IBLOCK_TYPE'] <>
''
666 && $this->arParams[
'LINK_IBLOCK_ID'] > 0
669 $linkElementIterator = \CIBlockElement::GetList(
670 array(
'SORT' =>
'ASC'),
672 'IBLOCK_ID' => $this->arParams[
'LINK_IBLOCK_ID'],
673 'IBLOCK_ACTIVE' =>
'Y',
674 'ACTIVE_DATE' =>
'Y',
676 'CHECK_PERMISSIONS' =>
'Y',
677 'IBLOCK_TYPE' => $this->arParams[
'LINK_IBLOCK_TYPE'],
678 'PROPERTY_'.$this->arParams[
'LINK_PROPERTY_SID'] => $element[
'ID'],
682 array(
'ID',
'IBLOCK_ID',
'NAME',
'DETAIL_PAGE_URL',
'IBLOCK_NAME')
684 while ($linkElement = $linkElementIterator->GetNext())
686 $element[
'LINKED_ELEMENTS'][] = $linkElement;
690 if (!$this->storage[
'SECTION'] && $element[
'IBLOCK_SECTION_ID'] > 0)
692 $sectionFilter = array(
693 'ID' => $element[
'IBLOCK_SECTION_ID'],
694 'IBLOCK_ID' => $element[
'IBLOCK_ID'],
697 $rsSection = \CIBlockSection::GetList(array(), $sectionFilter);
698 $rsSection->SetUrlTemplates(
'', $this->arParams[
'SECTION_URL']);
699 $this->storage[
'SECTION'] = $rsSection->GetNext();
702 if (!empty($this->storage[
'SECTION']))
705 'SEARCHABLE_CONTENT',
'~SEARCHABLE_CONTENT',
706 'TIMESTAMP_X',
'~TIMESTAMP_X',
707 'DATE_CREATE',
'~DATE_CREATE',
709 foreach ($blackList as $fieldName)
711 if (array_key_exists($fieldName, $this->storage[
'SECTION']))
713 unset($this->storage[
'SECTION'][$fieldName]);
716 unset($fieldName, $blackList);
718 $this->storage[
'SECTION'][
'PATH'] = array();
719 $rsPath = \CIBlockSection::GetNavChain(
720 $element[
'IBLOCK_ID'],
721 $this->storage[
'SECTION'][
'ID'],
723 'ID',
'CODE',
'XML_ID',
'EXTERNAL_ID',
'IBLOCK_ID',
724 'IBLOCK_SECTION_ID',
'SORT',
'NAME',
'ACTIVE',
725 'DEPTH_LEVEL',
'SECTION_PAGE_URL'
728 $rsPath->SetUrlTemplates(
'', $this->arParams[
'SECTION_URL']);
729 while ($path = $rsPath->GetNext())
731 if ($this->arParams[
"ADD_SECTIONS_CHAIN"])
734 $path[
'IPROPERTY_VALUES'] = $ipropValues->getValues();
737 $this->storage[
'SECTION'][
'PATH'][] = $path;
740 if ($this->arParams[
'SECTIONS_CHAIN_START_FROM'] > 0)
742 $this->storage[
'SECTION'][
'PATH'] = array_slice($this->storage[
'SECTION'][
'PATH'], $this->arParams[
'SECTIONS_CHAIN_START_FROM']);
745 $element[
'SECTION'] = $this->storage[
'SECTION'];
754 $uniqueSortHash = array();
756 foreach ($offers as $offer)
758 $elementId = $offer[
'LINK_ELEMENT_ID'];
760 if (!isset($this->elementLinks[$elementId]))
763 if (!isset($uniqueSortHash[$elementId]))
765 $uniqueSortHash[$elementId] = array();
768 $uniqueSortHash[$elementId][$offer[
'SORT_HASH']] =
true;
770 if ($this->elementLinks[$elementId][
'OFFER_ID_SELECTED'] == 0 && $offer[
'CAN_BUY'])
772 $this->elementLinks[$elementId][
'OFFER_ID_SELECTED'] = $offer[
'ID'];
775 unset($elementId, $offer);
777 foreach ($this->elementLinks as &$element)
779 if ($element[
'OFFER_ID_SELECTED'] == 0)
782 if (count($uniqueSortHash[$element[
'ID']]) < 2)
784 $element[
'OFFER_ID_SELECTED'] = 0;
791 $resultCacheKeys = array(
797 'CANONICAL_PAGE_URL',
802 'USE_CATALOG_BUTTONS'
808 $this->arParams[
'SET_TITLE']
809 || $this->arParams[
'ADD_ELEMENT_CHAIN']
810 || $this->arParams[
'SET_BROWSER_TITLE'] ===
'Y'
811 || $this->arParams[
'SET_META_KEYWORDS'] ===
'Y'
812 || $this->arParams[
'SET_META_DESCRIPTION'] ===
'Y'
815 $this->arResult[
'META_TAGS'] = array();
816 $resultCacheKeys[] =
'META_TAGS';
818 $elementTitle = $this->arResult[
'NAME'];
820 isset($this->arResult[
'IPROPERTY_VALUES'][
'ELEMENT_PAGE_TITLE'])
821 && $this->arResult[
'IPROPERTY_VALUES'][
'ELEMENT_PAGE_TITLE'] !==
''
824 $elementTitle = $this->arResult[
'IPROPERTY_VALUES'][
'ELEMENT_PAGE_TITLE'];
826 if ($this->arParams[
'SET_TITLE'])
828 $this->arResult[
'META_TAGS'][
'TITLE'] = $elementTitle;
831 if ($this->arParams[
'ADD_ELEMENT_CHAIN'])
833 $this->arResult[
'META_TAGS'][
'ELEMENT_CHAIN'] = $elementTitle;
836 if ($this->arParams[
'SET_BROWSER_TITLE'] ===
'Y')
838 $browserTitle = Collection::firstNotEmpty(
839 $this->arResult[
'PROPERTIES'], array($this->arParams[
'BROWSER_TITLE'],
'VALUE'),
840 $this->arResult, $this->arParams[
'BROWSER_TITLE'],
841 $this->arResult[
'IPROPERTY_VALUES'],
'ELEMENT_META_TITLE'
843 $this->arResult[
'META_TAGS'][
'BROWSER_TITLE'] = is_array($browserTitle)
844 ? implode(
' ', $browserTitle)
846 unset($browserTitle);
849 if ($this->arParams[
'SET_META_KEYWORDS'] ===
'Y')
851 $metaKeywords = Collection::firstNotEmpty(
852 $this->arResult[
'PROPERTIES'], array($this->arParams[
'META_KEYWORDS'],
'VALUE'),
853 $this->arResult[
'IPROPERTY_VALUES'],
'ELEMENT_META_KEYWORDS'
855 $this->arResult[
'META_TAGS'][
'KEYWORDS'] = is_array($metaKeywords)
856 ? implode(
' ', $metaKeywords)
858 unset($metaKeywords);
861 if ($this->arParams[
'SET_META_DESCRIPTION'] ===
'Y')
863 $metaDescription = Collection::firstNotEmpty(
864 $this->arResult[
'PROPERTIES'], array($this->arParams[
'META_DESCRIPTION'],
'VALUE'),
865 $this->arResult[
'IPROPERTY_VALUES'],
'ELEMENT_META_DESCRIPTION'
867 $this->arResult[
'META_TAGS'][
'DESCRIPTION'] = is_array($metaDescription)
868 ? implode(
' ', $metaDescription)
870 unset($metaDescription);
874 return $resultCacheKeys;
889 global $APPLICATION, $USER;
891 if (!$USER->IsAuthorized())
894 $arResult =& $this->arResult;
897 $APPLICATION->GetShowIncludeAreas()
898 || $this->arParams[
'SET_TITLE']
899 || isset($arResult[$this->arParams[
'BROWSER_TITLE']])
902 if (Loader::includeModule(
'iblock'))
905 'add_element' => \CIBlock::GetArrayByID($this->arParams[
'IBLOCK_ID'],
'DETAIL_PAGE_URL'),
907 isset($arResult[
'SECTION'])
908 ? $arResult[
'SECTION'][
'SECTION_PAGE_URL']
909 : $arResult[
'LIST_PAGE_URL'],
911 $buttonParams = array(
912 'RETURN_URL' => $returnUrl,
916 if (isset($arResult[
'USE_CATALOG_BUTTONS']))
918 $buttonParams[
'USE_CATALOG_BUTTONS'] = $arResult[
'USE_CATALOG_BUTTONS'];
919 if (!empty($buttonParams[
'USE_CATALOG_BUTTONS']))
921 $buttonParams[
'SHOW_CATALOG_BUTTONS'] =
true;
925 $buttons = \CIBlock::GetPanelButtons(
926 $arResult[
'IBLOCK_ID'],
928 $arResult[
'IBLOCK_SECTION_ID'],
931 unset($buttonParams);
933 if ($APPLICATION->GetShowIncludeAreas())
935 $this->addIncludeAreaIcons(\CIBlock::GetComponentMenu($APPLICATION->GetPublicShowMode(), $buttons));
938 if ($this->arParams[
'SET_TITLE'] || isset($arResult[$this->arParams[
'BROWSER_TITLE']]))
940 $this->storage[
'TITLE_OPTIONS'] =
null;
941 if (isset($buttons[
'submenu'][
'edit_element']))
943 $this->storage[
'TITLE_OPTIONS'] = [
944 'ADMIN_EDIT_LINK' => $buttons[
'submenu'][
'edit_element'][
'ACTION'],
945 'PUBLIC_EDIT_LINK' => $buttons[
'edit'][
'edit_element'][
'ACTION'],
946 'COMPONENT_NAME' => $this->getName(),
969 $arResult =& $this->arResult;
971 if ($this->arParams[
'SET_CANONICAL_URL'] ===
'Y' && $arResult[
"CANONICAL_PAGE_URL"])
972 $APPLICATION->SetPageProperty(
'canonical', $arResult[
"CANONICAL_PAGE_URL"]);
974 if ($this->arParams[
'SET_TITLE'])
976 $APPLICATION->SetTitle($arResult[
"META_TAGS"][
"TITLE"], $this->storage[
'TITLE_OPTIONS']);
979 if ($this->arParams[
'SET_BROWSER_TITLE'] ===
'Y')
981 if ($arResult[
"META_TAGS"][
"BROWSER_TITLE"] !==
'')
983 $APPLICATION->SetPageProperty(
"title", $arResult[
"META_TAGS"][
"BROWSER_TITLE"], $this->storage[
'TITLE_OPTIONS']);
987 if ($this->arParams[
'SET_META_KEYWORDS'] ===
'Y')
989 if ($arResult[
"META_TAGS"][
"KEYWORDS"] !==
'')
991 $APPLICATION->SetPageProperty(
"keywords", $arResult[
"META_TAGS"][
"KEYWORDS"], $this->storage[
'TITLE_OPTIONS']);
995 if ($this->arParams[
'SET_META_DESCRIPTION'] ===
'Y')
997 if ($arResult[
"META_TAGS"][
"DESCRIPTION"] !==
'')
999 $APPLICATION->SetPageProperty(
"description", $arResult[
"META_TAGS"][
"DESCRIPTION"], $this->storage[
'TITLE_OPTIONS']);
1003 if (!empty($arResult[
'BACKGROUND_IMAGE']) && is_array($arResult[
'BACKGROUND_IMAGE']))
1005 $APPLICATION->SetPageProperty(
1007 'style="background-image: url(\''.\CHTTP::urnEncode($arResult[
'BACKGROUND_IMAGE'][
'SRC'],
'UTF-8').
'\')
"'
1011 if ($this->arParams['ADD_SECTIONS_CHAIN'] && !empty($arResult['SECTION']['PATH']) && is_array($arResult['SECTION']['PATH']))
1013 foreach ($arResult['SECTION']['PATH'] as $path)
1015 if (isset($path['IPROPERTY_VALUES']['SECTION_PAGE_TITLE']) && $path['IPROPERTY_VALUES']['SECTION_PAGE_TITLE'] !== '')
1017 $APPLICATION->AddChainItem($path['IPROPERTY_VALUES']['SECTION_PAGE_TITLE'], $path['~SECTION_PAGE_URL']);
1021 $APPLICATION->AddChainItem($path['NAME'], $path['~SECTION_PAGE_URL']);
1026 if ($this->arParams['ADD_ELEMENT_CHAIN'])
1028 $APPLICATION->AddChainItem($arResult["META_TAGS
"]["ELEMENT_CHAIN
"]);
1031 if ($this->arParams['SET_LAST_MODIFIED'] && $arResult['TIMESTAMP_X'])
1033 Main\Context::getCurrent()->getResponse()->setLastModified(DateTime::createFromUserTime($arResult["TIMESTAMP_X
"]));