- Модуль: landing
- Путь к файлу: ~/bitrix/modules/landing/lib/publicaction/cloud.php
- Класс: BitrixLandingPublicActionCloud
- Вызов: Cloud::getDemoItemList
static function getDemoItemList(string $type, bool $isPage, array $filter = []): PublicActionResult
{
if ($isPage)
{
$result = Demos::getPageList($type)->getResult();
}
else
{
$result = Demos::getSiteList($type)->getResult();
}
// we need only used in public templates
if (
$result &&
isset($filter['used_in_public']) &&
$filter['used_in_public'] == 'Y'
)
{
$resultNotPublic = $result;
$res = Site::getList([
'select' => [
'ID', 'TITLE', 'TPL_CODE'
],
'filter' => [
'=ACTIVE' => 'Y',
'=TPL_CODE' => array_keys($resultNotPublic)
]
]);
while ($row = $res->fetch())
{
unset($resultNotPublic[$row['TPL_CODE']]);
}
foreach ($resultNotPublic as $key => $foo)
{
unset($result[$key]);
}
}
// we need't local templates, only from rest
if (
$result &&
isset($filter['only_rest']) &&
$filter['only_rest'] == 'Y'
)
{
foreach ($result as $key => $item)
{
if (!$item['REST'])
{
unset($result[$key]);
}
}
}
$actionResult = new PublicActionResult;
$actionResult->setResult($result);
return $actionResult;
}