bitrix-events
Installation
SKILL.md
Bitrix events
Baseline: main 23.0+ · Verified: main 26.800.0
Who dispatches decides the handler signature
| Dispatcher (find it in the caller) | Examples | Handler receives | Result |
|---|---|---|---|
new Event(...) + ->send() |
own events, main:OnBeforeMailSend, ORM tablet events |
VERSION 2 (registerEventHandler, addEventHandler): the Event object. VERSION 1 (*Compatible): ...array_values($params) |
$event->getResults(); non-EventResult returns are wrapped as UNDEFINED |
GetModuleEvents() + ExecuteModuleEventEx() (legacy) |
main:OnBeforeUserAdd, OnAfterUserAdd, OnPageStart, OnEpilog, iblock:OnBeforeIBlockElementAdd |
raw args, whatever VERSION was registered — e.g. array &$arFields |
caller-specific |
- Legacy
OnBefore*: cancel =$APPLICATION->ThrowException('…'); return false;(callers check=== false). Modify data through the reference&$arFields; a returned array (['FIELDS' => …]) is ignored. - ORM tablet / highload record events use
Bitrix\Main\ORM\EventManagerandORM\EventResult::modifyFields()— seebitrix-orm; HL event names —bitrix-highloadblock.
Publish a D7 event
php bitrix.php make:event PostCreated -m vendor.blog -C Post (Since main 25.900; older: write the class) → Vendor\Blog\Public\Event\Post\PostCreatedEvent (without -C: …\Public\Event\). The generated class passes no params — add them: