Свои обработчики в своих модулях в 1С-Битрикс D7

$arMacros["PRODUCTS"]  = "";  
$basketId = "10";
$event = new \Bitrix\Main\Event("mymodule", "OnMacrosProductCreate",array($basketId));
   $event->send();
   if ($event->getResults()){
      foreach($event->getResults() as $evenResult){
         if($evenResult->getResultType() == \Bitrix\Main\EventResult::SUCCESS){
         $arMacros["PRODUCTS"] = $evenResult->getParameters();
      }
   }
}
$eventManager = \Bitrix\Main\EventManager::getInstance();
$eventManager->addEventHandler("mymodule", "OnMacrosProductCreate", "OnMacrosProductCreate");

function OnMacrosProductCreate(\Bitrix\Main\Event $event){
   $arParam = $event->getParameters();
   $basketId = $arParam[0];
   $result = new \Bitrix\Main\EventResult(1,$basketId);
    return $result;
}

Источник: https://dev.1c-bitrix.ru/community/webdev/user/87386/blog/11342/