} if ($bSectionProperty) { $arFields["SECTION_PROPERTY"] = "Y"; } unset($arPropertyCodes); if ($bDublicate) { $bVarsFromForm = true; $strWarning .= GetMessage('IB_E_ERR_PROPERTY_CODE_DUBLICATE_EXT') . ' ' . implode(', ', array_keys($arDublicateCodes)) . '<br>'; } unset($arDublicateCodes); unset($bDublicate); if (is_array($_POST["IPROPERTY_TEMPLATES"])) { $SECTION_PICTURE_FILE_NAME = \Bitrix\Iblock\Template\Helper::convertArrayToModifiers($_POST["IPROPERTY_TEMPLATES"]["SECTION_PICTURE_FILE_NAME"]); $SECTION_DETAIL_PICTURE_FILE_NAME = \Bitrix\Iblock\Template\Helper::convertArrayToModifiers($_POST["IPROPERTY_TEMPLATES"]["SECTION_DETAIL_PICTURE_FILE_NAME"]); $ELEMENT_PREVIEW_PICTURE_FILE_NAME = \Bitrix\Iblock\Template\Helper::convertArrayToModifiers($_POST["IPROPERTY_TEMPLATES"]["ELEMENT_PREVIEW_PICTURE_FILE_NAME"]); $ELEMENT_DETAIL_PICTURE_FILE_NAME = \Bitrix\Iblock\Template\Helper::convertArrayToModifiers($_POST["IPROPERTY_TEMPLATES"]["ELEMENT_DETAIL_PICTURE_FILE_NAME"]); $arFields["IPROPERTY_TEMPLATES"] = array("SECTION_META_TITLE" => $_POST["IPROPERTY_TEMPLATES"]["SECTION_META_TITLE"]["TEMPLATE"], "SECTION_META_KEYWORDS" => $_POST["IPROPERTY_TEMPLATES"]["SECTION_META_KEYWORDS"]["TEMPLATE"], "SECTION_META_DESCRIPTION" => $_POST["IPROPERTY_TEMPLATES"]["SECTION_META_DESCRIPTION"]["TEMPLATE"], "SECTION_PAGE_TITLE" => $_POST["IPROPERTY_TEMPLATES"]["SECTION_PAGE_TITLE"]["TEMPLATE"], "ELEMENT_META_TITLE" => $_POST["IPROPERTY_TEMPLATES"]["ELEMENT_META_TITLE"]["TEMPLATE"], "ELEMENT_META_KEYWORDS" => $_POST["IPROPERTY_TEMPLATES"]["ELEMENT_META_KEYWORDS"]["TEMPLATE"], "ELEMENT_META_DESCRIPTION" => $_POST["IPROPERTY_TEMPLATES"]["ELEMENT_META_DESCRIPTION"]["TEMPLATE"], "ELEMENT_PAGE_TITLE" => $_POST["IPROPERTY_TEMPLATES"]["ELEMENT_PAGE_TITLE"]["TEMPLATE"], "SECTION_PICTURE_FILE_ALT" => $_POST["IPROPERTY_TEMPLATES"]["SECTION_PICTURE_FILE_ALT"]["TEMPLATE"], "SECTION_PICTURE_FILE_TITLE" => $_POST["IPROPERTY_TEMPLATES"]["SECTION_PICTURE_FILE_TITLE"]["TEMPLATE"], "SECTION_PICTURE_FILE_NAME" => $SECTION_PICTURE_FILE_NAME, "SECTION_DETAIL_PICTURE_FILE_ALT" => $_POST["IPROPERTY_TEMPLATES"]["SECTION_DETAIL_PICTURE_FILE_ALT"]["TEMPLATE"], "SECTION_DETAIL_PICTURE_FILE_TITLE" => $_POST["IPROPERTY_TEMPLATES"]["SECTION_DETAIL_PICTURE_FILE_TITLE"]["TEMPLATE"], "SECTION_DETAIL_PICTURE_FILE_NAME" => $SECTION_DETAIL_PICTURE_FILE_NAME, "ELEMENT_PREVIEW_PICTURE_FILE_ALT" => $_POST["IPROPERTY_TEMPLATES"]["ELEMENT_PREVIEW_PICTURE_FILE_ALT"]["TEMPLATE"], "ELEMENT_PREVIEW_PICTURE_FILE_TITLE" => $_POST["IPROPERTY_TEMPLATES"]["ELEMENT_PREVIEW_PICTURE_FILE_TITLE"]["TEMPLATE"], "ELEMENT_PREVIEW_PICTURE_FILE_NAME" => $ELEMENT_PREVIEW_PICTURE_FILE_NAME, "ELEMENT_DETAIL_PICTURE_FILE_ALT" => $_POST["IPROPERTY_TEMPLATES"]["ELEMENT_DETAIL_PICTURE_FILE_ALT"]["TEMPLATE"], "ELEMENT_DETAIL_PICTURE_FILE_TITLE" => $_POST["IPROPERTY_TEMPLATES"]["ELEMENT_DETAIL_PICTURE_FILE_TITLE"]["TEMPLATE"], "ELEMENT_DETAIL_PICTURE_FILE_NAME" => $ELEMENT_DETAIL_PICTURE_FILE_NAME); } $bCreateRecord = $ID <= 0; if (!$bVarsFromForm) { $res_log["NAME"] = $NAME; if ($ID > 0) { $res = $ib->Update($ID, $arFields); if (COption::GetOptionString("iblock", "event_log_iblock", "N") === "Y" && $res) { CEventLog::Log("IBLOCK", "IBLOCK_EDIT", "iblock", $ID, serialize($res_log)); } } else { $arFields["VERSION"] = $VERSION; $ID = $ib->Add($arFields); $res = $ID > 0; if (COption::GetOptionString("iblock", "event_log_iblock", "N") === "Y" && $res) {
if (is_array($_POST["IBLOCK_SECTION"])) { $section_id = min(array_filter($_POST["IBLOCK_SECTION"], "strlen")); } else { $section_id = 0; } $arFields = array("IBLOCK_ID" => $_REQUEST["IBLOCK_ID"], "IBLOCK_SECTION_ID" => $section_id, "NAME" => $_POST["NAME"], "CODE" => $_POST["CODE"], "PREVIEW_TEXT" => $_POST["PREVIEW_TEXT"], "DETAIL_TEXT" => $_POST["DETAIL_TEXT"]); } else { $ipropTemplates = null; $arFields = array(); } if ($ipropTemplates) { $values = $ipropTemplates->getValuesEntity(); $entity = $values->createTemplateEntity(); $entity->setFields($arFields); $templates = $ipropTemplates->findTemplates(); if (is_array($_POST["IPROPERTY_TEMPLATES"])) { foreach ($_POST["IPROPERTY_TEMPLATES"] as $TEMPLATE_NAME => $TEMPLATE_VALUE) { $templates[$TEMPLATE_NAME] = array("TEMPLATE" => \Bitrix\Iblock\Template\Helper::convertArrayToModifiers($TEMPLATE_VALUE)); } } $result = array(); foreach ($templates as $TEMPLATE_NAME => $templateInfo) { $result[] = array("id" => $TEMPLATE_NAME, "value" => \Bitrix\Main\Text\String::htmlEncode(\Bitrix\Iblock\Template\Engine::process($entity, $templateInfo["TEMPLATE"]))); } echo CUtil::PhpToJSObject($result); //$entity = $values->createTemplateEntity(); //$entity->setFields($arFields); //$templates = $values->getTemplateEntity(); } } require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/epilog_after.php";