- Модуль: landing
- Путь к файлу: ~/bitrix/modules/landing/lib/hook.php
- Класс: BitrixLandingHook
- Вызов: Hook::getData
static function getData($id, $type, $asIs = false): array
{
$data = [];
$id = (int)$id;
if (!is_string($type))
{
return $data;
}
$res = HookData::getList([
'select' => [
'ID', 'HOOK', 'CODE', 'VALUE'
],
'filter' => [
'ENTITY_ID' => $id,
'=ENTITY_TYPE' => $type,
'=PUBLIC' => self::$editMode ? 'N' : 'Y'
],
'order' => [
'ID' => 'asc'
]
]);
while ($row = $res->fetch())
{
if (!isset($data[$row['HOOK']]))
{
$data[$row['HOOK']] = [];
}
if (mb_strpos($row['VALUE'], 'serialized#') === 0)
{
$row['VALUE'] = unserialize(mb_substr($row['VALUE'], 11), ['allowed_classes' => false]);
}
$data[$row['HOOK']][$row['CODE']] = $asIs ? $row : $row['VALUE'];
}
return $data;
}