- Модуль: iblock
- Путь к файлу: ~/bitrix/modules/iblock/lib/component/element.php
- Класс: BitrixIblockComponentElement
- Вызов: Element::initMetaData
protected function initMetaData()
{
global $APPLICATION;
$arResult =& $this->arResult;
if ($this->arParams['SET_CANONICAL_URL'] === 'Y' && $arResult["CANONICAL_PAGE_URL"])
$APPLICATION->SetPageProperty('canonical', $arResult["CANONICAL_PAGE_URL"]);
if ($this->arParams['SET_TITLE'])
{
$APPLICATION->SetTitle($arResult["META_TAGS"]["TITLE"], $this->storage['TITLE_OPTIONS']);
}
if ($this->arParams['SET_BROWSER_TITLE'] === 'Y')
{
if ($arResult["META_TAGS"]["BROWSER_TITLE"] !== '')
{
$APPLICATION->SetPageProperty("title", $arResult["META_TAGS"]["BROWSER_TITLE"], $this->storage['TITLE_OPTIONS']);
}
}
if ($this->arParams['SET_META_KEYWORDS'] === 'Y')
{
if ($arResult["META_TAGS"]["KEYWORDS"] !== '')
{
$APPLICATION->SetPageProperty("keywords", $arResult["META_TAGS"]["KEYWORDS"], $this->storage['TITLE_OPTIONS']);
}
}
if ($this->arParams['SET_META_DESCRIPTION'] === 'Y')
{
if ($arResult["META_TAGS"]["DESCRIPTION"] !== '')
{
$APPLICATION->SetPageProperty("description", $arResult["META_TAGS"]["DESCRIPTION"], $this->storage['TITLE_OPTIONS']);
}
}
if (!empty($arResult['BACKGROUND_IMAGE']) && is_array($arResult['BACKGROUND_IMAGE']))
{
$APPLICATION->SetPageProperty(
'backgroundImage',
'style="background-image: url(''.CHTTP::urnEncode($arResult['BACKGROUND_IMAGE']['SRC'], 'UTF-8').'')"'
);
}
if ($this->arParams['ADD_SECTIONS_CHAIN'] && !empty($arResult['SECTION']['PATH']) && is_array($arResult['SECTION']['PATH']))
{
foreach ($arResult['SECTION']['PATH'] as $path)
{
if (isset($path['IPROPERTY_VALUES']['SECTION_PAGE_TITLE']) && $path['IPROPERTY_VALUES']['SECTION_PAGE_TITLE'] !== '')
{
$APPLICATION->AddChainItem($path['IPROPERTY_VALUES']['SECTION_PAGE_TITLE'], $path['~SECTION_PAGE_URL']);
}
else
{
$APPLICATION->AddChainItem($path['NAME'], $path['~SECTION_PAGE_URL']);
}
}
}
if ($this->arParams['ADD_ELEMENT_CHAIN'])
{
$APPLICATION->AddChainItem($arResult["META_TAGS"]["ELEMENT_CHAIN"]);
}
if ($this->arParams['SET_LAST_MODIFIED'] && $arResult['TIMESTAMP_X'])
{
MainContext::getCurrent()->getResponse()->setLastModified(DateTime::createFromUserTime($arResult["TIMESTAMP_X"]));
}
}