Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
conversionhandler.php
1
<?php
2
namespace
Bitrix\Seo
;
3
4
use
Bitrix\Conversion\DayContext
;
5
use
Bitrix\Main\Localization\Loc
;
6
use
Bitrix\Seo\Adv\YandexBannerTable
;
7
8
Loc::loadMessages
(__FILE__);
9
10
class
ConversionHandler
11
{
12
public
static
function
onSetDayContextAttributes
(
DayContext
$context)
13
{
14
if
(
AdvSession::isSession
())
15
{
16
$context->
setAttribute
(
'seo_yandex_direct_source'
, static::getSeoId());
17
}
18
}
19
20
protected
static
function
getSeoId
()
21
{
22
$session =
AdvSession::getSession
();
23
24
return
$session[
'BANNER_ID'
] ??
null
;
25
}
26
27
public
static
function
onGetAttributeTypes
()
28
{
29
return
array(
30
'seo_yandex_direct_source'
=> array(
31
'MODULE'
=>
'seo'
,
32
'GROUP'
=>
'source'
,
33
'SORT'
=> 5200,
// must be before conversion_search_engine!
34
'NAME'
=>
Loc::getMessage
(
'SEO_CONVERSION_ATTRIBUTE_YANDEX_DIRECT_NAME'
),
35
'BG_COLOR'
=>
'#4bbedb'
,
36
'GET_VALUES'
=>
function
(array $ids)
37
{
38
$dbRes = YandexBannerTable::getList(array(
39
'filter'
=> array(
"=XML_ID"
=> $ids),
40
'select'
=> array(
"XML_ID"
,
"NAME"
),
41
'order'
=> array(
'NAME'
=>
'ASC'
),
42
));
43
44
$bannerList = array();
45
while
($banner = $dbRes->fetch())
46
{
47
$bannerList[$banner[
'XML_ID'
]] = array(
"NAME"
=> $banner[
"NAME"
]);
48
}
49
50
return
$bannerList;
51
},
52
'SPLIT_BY'
=>
'seo_yandex_direct_source'
,
53
),
54
);
55
}
56
}
Bitrix\Conversion\DayContext
Definition
daycontext.php:14
Bitrix\Conversion\Internals\BaseContext\setAttribute
setAttribute($name, $value=null)
Definition
basecontext.php:101
Bitrix\Main\Localization\Loc
Definition
loc.php:11
Bitrix\Main\Localization\Loc\loadMessages
static loadMessages($file)
Definition
loc.php:64
Bitrix\Main\Localization\Loc\getMessage
static getMessage($code, $replace=null, $language=null)
Definition
loc.php:29
Bitrix\Seo\Adv\YandexBannerTable
Definition
yandexbanner.php:52
Bitrix\Seo\AdvSession\isSession
static isSession()
Definition
advsession.php:56
Bitrix\Seo\AdvSession\getSession
static getSession()
Definition
advsession.php:69
Bitrix\Seo\ConversionHandler
Definition
conversionhandler.php:11
Bitrix\Seo\ConversionHandler\onSetDayContextAttributes
static onSetDayContextAttributes(DayContext $context)
Definition
conversionhandler.php:12
Bitrix\Seo\ConversionHandler\getSeoId
static getSeoId()
Definition
conversionhandler.php:20
Bitrix\Seo\ConversionHandler\onGetAttributeTypes
static onGetAttributeTypes()
Definition
conversionhandler.php:27
Bitrix\Seo
modules
seo
lib
conversionhandler.php
Создано системой
1.10.0