Skip to content

Commit

Permalink
added event OnBeforeSeoSetCityName on {=get_city}
Browse files Browse the repository at this point in the history
  • Loading branch information
darkfriend committed Feb 19, 2020
1 parent 5a700cf commit 9c26f9d
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 30 deletions.
35 changes: 20 additions & 15 deletions utf8/dev2fun.multidomain/classes/general/TemplateSeo.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,24 @@

class TemplateSeo extends \Bitrix\Iblock\Template\Functions\FunctionBase
{
/**
* Обработчик события на вход получает имя требуемой функции
* @example {=get_city}
* @param \Bitrix\Main\Event $event
* @return string
*/
public static function EventHandler(\Bitrix\Main\Event $event) {
$parameters = $event->getParameters();
$functionName = $parameters[0];
if ($functionName === "get_city") {
return \Dev2fun\MultiDomain\Base::GetCurrentDomain()['UF_NAME'];
} else {
return '';
}
}
/**
* Обработчик события на вход получает имя требуемой функции
* @param \Bitrix\Main\Event $event
* @return string
* @example {=get_city}
*/
public static function EventHandler(\Bitrix\Main\Event $event)
{
$parameters = $event->getParameters();
$functionName = $parameters[0];
if ($functionName === "get_city") {
$currentDomain = \Dev2fun\MultiDomain\Base::GetCurrentDomain();
$cityName = $currentDomain['UF_NAME'];
foreach (GetModuleEvents('dev2fun.multidomain', "OnBeforeSeoSetCityName", true) as $arEvent)
ExecuteModuleEventEx($arEvent, [&$cityName, $currentDomain]);
return $cityName;
} else {
return '';
}
}
}
35 changes: 20 additions & 15 deletions win1251/dev2fun.multidomain/classes/general/TemplateSeo.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,24 @@

class TemplateSeo extends \Bitrix\Iblock\Template\Functions\FunctionBase
{
/**
* Обработчик события на вход получает имя требуемой функции
* @example {=get_city}
* @param \Bitrix\Main\Event $event
* @return string
*/
public static function EventHandler(\Bitrix\Main\Event $event) {
$parameters = $event->getParameters();
$functionName = $parameters[0];
if ($functionName === "get_city") {
return \Dev2fun\MultiDomain\Base::GetCurrentDomain()['UF_NAME'];
} else {
return '';
}
}
/**
* Обработчик события на вход получает имя требуемой функции
* @param \Bitrix\Main\Event $event
* @return string
* @example {=get_city}
*/
public static function EventHandler(\Bitrix\Main\Event $event)
{
$parameters = $event->getParameters();
$functionName = $parameters[0];
if ($functionName === "get_city") {
$currentDomain = \Dev2fun\MultiDomain\Base::GetCurrentDomain();
$cityName = $currentDomain['UF_NAME'];
foreach (GetModuleEvents('dev2fun.multidomain', "OnBeforeSeoSetCityName", true) as $arEvent)
ExecuteModuleEventEx($arEvent, [&$cityName, $currentDomain]);
return $cityName;
} else {
return '';
}
}
}

0 comments on commit 9c26f9d

Please sign in to comment.