Last active
March 5, 2024 12:39
-
-
Save demoriz/3ca6275e7a33c535d686f51aa0be6c43 to your computer and use it in GitHub Desktop.
bitrix d7 'highload element add'
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Bitrix\Highloadblock\HighloadBlockTable; | |
use Bitrix\Main\Loader; | |
Loader::includeModule('highloadblock'); | |
// comment | |
// $intIblockID = 96; | |
// $arHLBlock = HighloadBlockTable::getById($intIblockID)->fetch(); | |
$arHLBlock = HighloadBlockTable::getList(array('filter' => array('TABLE_NAME' => 'b_hlbd_bla_bla')))->fetch(); | |
$entity = HighloadBlockTable::compileEntity($arHLBlock); | |
$strEntityDataClass = $entity->getDataClass(); | |
$arData = array( | |
'UF_FIELD' => 'VALUE' | |
); | |
$result = $strEntityDataClass::add($arData); | |
if ($result->isSuccess()) { | |
$intID = $result->getId(); | |
echo $intID; | |
} else { | |
echo 'error: ' . $result->getErrorMessages(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment