Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
cookies.php
1<?php
3
4use \Bitrix\Main\Engine\Controller;
5
6class Cookies extends Controller
7{
8 public function getDefaultPreFilters()
9 {
10 return [];
11 }
12
18 public function getAgreementsAction(int $siteId): array
19 {
20 $mainAgreement = \Bitrix\Landing\Site\Cookies::getMainAgreement(
22 );
23 $agreements = \Bitrix\Landing\Site\Cookies::getAgreements($siteId, true);
24
25 $data = [
26 'main' => $mainAgreement,
27 'analytic' => array_filter($agreements, function($item)
28 {
29 return $item['ACTIVE'] == 'Y' && $item['TYPE'] == 'analytic';
30 }),
31 'technical' => array_filter($agreements, function($item)
32 {
33 return $item['ACTIVE'] == 'Y' && $item['TYPE'] == 'technical';
34 }),
35 'other' => array_filter($agreements, function($item)
36 {
37 return $item['ACTIVE'] == 'Y' && $item['TYPE'] == 'other';
38 })
39 ];
40
41 foreach ($data as $key => $val)
42 {
43 if (!$val)
44 {
45 unset($data[$key]);
46 }
47 }
48
49 return $data;
50 }
51
58 public function acceptAgreementsAction(int $siteId, array $accepted = []): void
59 {
60 \Bitrix\Landing\Site\Cookies::acceptAgreement($siteId, $accepted);
61 }
62}
acceptAgreementsAction(int $siteId, array $accepted=[])
Definition cookies.php:58
static getAgreementIdBySiteId(int $siteId)
Definition cookies.php:209