<? if (!defined('B_PROLOG_INCLUDED') || B_PROLOG_INCLUDED !== true) die();



if (!empty($arResult["ITEMS"])) {
 $arResult['MAIN']=[];

  foreach ($arResult["ITEMS"] as $key => &$arItem) {
    if (!empty($arItem["PREVIEW_PICTURE"]["ID"])) {
      $arItem["PICTURE"] = CFile::ResizeImageGet($arItem["PREVIEW_PICTURE"]["ID"], array('width' => 460, 'height' => 310), BX_RESIZE_IMAGE_PROPORTIONAL, true)["src"];
    }

    if (!empty($arItem["DISPLAY_PROPERTIES"]["DATE"]["VALUE"])) {
      $arItem["DATE"] = CIBlockFormatProperties::DateFormat($arParams["ACTIVE_DATE_FORMAT"], MakeTimeStamp($arItem["DISPLAY_PROPERTIES"]["DATE"]["VALUE"], CSite::GetDateFormat()));
    }




  }

}
//главная новость
$arFilter = Array(
    "IBLOCK_ID"=>$arParams['IBLOCK_ID'],
    "ACTIVE"=>"Y",
    "PROPERTY_MAIN"=>"Y"
);
$res = CIBlockElement::GetList(Array(), $arFilter, false, false, $arSelect);
while($ob = $res->GetNextElement()) {
    $arItem = $ob->GetFields();
    $arItem['PREVIEW_PICTURE']= CFile::GetFileArray($arItem['PREVIEW_PICTURE']);
    $arItem['PROPERTIES'] = $ob->GetProperties();
    $arResult['MAIN'] = $arItem;


}
//хештеги
$arResult['HASHTAGS']=[];
$arFilter = Array(
    "IBLOCK_ID"=>$arParams['IBLOCK_ID'],
    "ACTIVE"=>"Y",

);
$res = CIBlockElement::GetList(Array(), $arFilter, false, false, $arSelect);
while($ob = $res->GetNextElement()) {
    $arItem = $ob->GetFields();
    $arItem['PROPERTIES'] = $ob->GetProperties();
    if ($arItem['PROPERTIES']['HASHTAG']['VALUE']!="") {
        $arResult['HASHTAGS'][] = $arItem['PROPERTIES']['HASHTAG']['VALUE'];
    }



}
$arResult['HASHTAGS']=array_unique($arResult['HASHTAGS']);

//название, title, текст под h1
$arFilter = Array(
    "IBLOCK_ID"=>43,
    "ACTIVE"=>"Y",
    "ID"=>258
);
$arResult['TITLE']=[];
$res = CIBlockElement::GetList(Array(), $arFilter, false, false, $arSelect);
while($ob = $res->GetNextElement()) {
    $arItem = $ob->GetFields();
    $arItem['PROPERTIES'] = $ob->GetProperties();

    $arResult['BREAD_NAME'] = $arItem['PROPERTIES']['BREAD_NAME']['VALUE'];
    $arResult['TITLE'] = $arItem;


}






