Свой тип данных Highload блоки

use Bitrix\Highloadblock\HighloadBlockTable as HLBT;
const MY_HL_BLOCK_ID = 5;
const MY_HL_BLOCK_ID2 = 6;

AddEventHandler(“iblock”,”OnIBlockPropertyBuildList”,array(“Property_Service_List_Class”,”GetUserTypeDescription”));
if(!class_exists(“Property_Service_List_Class”))
{
class Property_Service_List_Class
{
function GetUserTypeDescription()
{
return array(
“PROPERTY_TYPE” => “S”,
“USER_TYPE” => “EServiceList”,
“DESCRIPTION” => “Множественное поле”,
“GetPropertyFieldHtml” => array(“Property_Service_List_Class”,”GetPropertyFieldHtml”),
“GetPublicEditHTML” => array(“Property_Service_List_Class”,”GetPropertyFieldHtml”),
“ConvertToDB” => array(“Property_Service_List_Class”,”ConvertToDB”),
“ConvertFromDB” => array(“Property_Service_List_Class”,”ConvertFromDB”),
“GetAdminListViewHTML” => array(“Property_Service_List_Class”,”GetAdminListViewHTML”),
);
}

function GetEntityDataClass($HlBlockId) {
if (empty($HlBlockId) || $HlBlockId < 1)
{
return false;
}
$hlblock = HLBT::getById($HlBlockId)->fetch();
$entity = HLBT::compileEntity($hlblock);
$entity_data_class = $entity->getDataClass();
return $entity_data_class;
}

function GetPropertyFieldHtml($arProperty, $value, $strHTMLControlName)
{

$arResult = array();

$cache[$IBLOCK_ID] = array();

$html = ”;
$html = “<table>”;
$html .= “<tr>”;
/*
$html .= ‘<td><input type=”text” size=”35″ placeholder=”Наименование” name=”‘.$strHTMLControlName[‘VALUE’].'[]” value=”‘.$value[‘VALUE’][0].'” /></td>’;
*/
$entity_data_class = Property_Service_List_Class::GetEntityDataClass(MY_HL_BLOCK_ID);
$rsData = $entity_data_class::getList(array(‘select’ => array(‘*’)));
$html .='<td><select name=”‘.$strHTMLControlName[‘VALUE’].'[]” style=”margin-bottom:3px”>’;
$html .= ‘<option value=””>(не выбрано)</option>’;
while($el = $rsData->fetch()){
if ($value[‘VALUE’][0]==$el[“UF_NAME”]) { $clss=’selected=””‘; } else {$clss=”;}
$html .= ‘<option ‘.$clss.’ value=’.$el[“UF_NAME”].’>’;
if (empty($clss)) { $html .=$el[“UF_NAME”]; } else { $html .=$el[“UF_NAME”]; }
$html .= ‘</option>’;
}
$html .= ‘</select></td>’;

$html .= ‘<td><input type=”text” size=”10″ placeholder=”Количество” name=”‘.$strHTMLControlName[‘VALUE’].'[]” value=”‘.$value[‘VALUE’][1].'” /></td>’;
$entity_data_class = Property_Service_List_Class::GetEntityDataClass(MY_HL_BLOCK_ID2);
$rsData = $entity_data_class::getList(array(‘select’ => array(‘*’)));
$html .='<td><select name=”‘.$strHTMLControlName[‘VALUE’].'[]” style=”margin-bottom:3px”>’;
$html .= ‘<option value=””>(не выбрано)</option>’;
while($el = $rsData->fetch()){
if ($value[‘VALUE’][2]==$el[“UF_NAME”]) { $clss=’selected=””‘; } else {$clss=”;}
$html .= ‘<option ‘.$clss.’ value=’.$el[“UF_NAME”].’>’;
if (empty($clss)) { $html .=$el[“UF_NAME”]; } else { $html .=$el[“UF_NAME”]; }
$html .= ‘</option>’;
}
$html .= ‘</select></td>’;
$html .= ‘</tr>’;
$html .= “</table>”;
return $html;
}

function ConvertToDB($arProperty, $value)
{
if($value[‘VALUE’][0]!=”) {
$value[‘VALUE’] = serialize($value[‘VALUE’]);
} else {
$value[‘VALUE’] = null;
}
return $value;
}

function ConvertFromDB($arProperty, $value){
if(strlen($value[“VALUE”])>0) {
$tmpArr = unserialize($value[“VALUE”]);
if(is_array($tmpArr) && count($tmpArr))
$value[“VALUE”] = $tmpArr;
} else {
$value[“VALUE”] = null;
}
return $value;
}

function GetAdminListViewHTML($arProperty, $value, $strHTMLControlName) {
if(is_array($value[“VALUE”]) && count($value[“VALUE”])) {
$tmpArr = array();
$tmpArr[] = “[“.$value[‘VALUE’][0].”] – “.$value[‘VALUE’][1];

return implode(” /\n”,$tmpArr);
}
else
{
return htmlspecialcharsex($value[“VALUE”]);
}
}

}
}