Views: 1964 (Data available since 06.02.2017)

Event system is somewhat changed in core D7. Requirements for data belonging to a code triggering the event are leveled down. An example of an event sending:

$event = new Bitrix\Main\Event("main", "OnPageStart");
$event->send();

If necessary, for a sending party there is a possibility to receive the result of an event handled by accepting parties.

foreach ($event->getResults() as $eventResult)
{
   if ($eventResult->getResultType() == \Bitrix\Main\EventResult::ERROR)
   {
      . . .   
   }
}

In order to reduce the code quantity Bitrix\Main\Event class successors may be created for specific event types. For example, Bitrix\Main\Entity\Event makes it more convenient to send events connected with the modification of entities.




Courses developed by «Bitrix», Inc.