digital-spectr / ds-bitrix-event-handlers
事件处理器
Requires
- php: >=5.5.0
README
常用事件处理器
/** * 在添加信息块之前 * * 默认设置信息块读取权限 */ iblock_OnBeforeIBlockAdd_FixIBlockPermissions
/** * 在发送邮件之前 * * 调整配送信息 */ main_OnBeforeEventSend_ChangeTrackingNumberFields
/** * 在发送订单状态更改邮件时 * * 改变配送信息和用户信息 */ sale_OnOrderStatusSendEmail_ChangeDeliveryNameAndOrderUser
使用方法
安装后,将类文件连接到 init.php 中 require_once($_SERVER['DOCUMENT_ROOT'] . '/vendor/digital-spectr/ds-bitrix-event-handlers/EventHandlersLoader.php');
接下来使用以下方法: EventHandlersLoader::includeEventHandler(); - 连接所有处理器 EventHandlersLoader::includeEventHandler("iblock_OnBeforeIBlockAdd_FixIBlockPermissions"); - 连接处理器 iblock_OnBeforeIBlockAdd_FixIBlockPermissions
HelperEventHandlers 中处理器文件夹和文件的层次结构如下: /HelperEventHandlers/[模块]/[事件]/[在 init.php 或 handlers.php 中可给处理器的名称].php
示例: /HelperEventHandlers/iblock/OnBeforeIBlockAdd/FixIBlockPermissions.php
处理器名称的格式如下: [模块]_[事件]_[在 init.php 或 handlers.php 中可给处理器的名称]
可以使用方法 EventHandlersLoader::getEventHandlersInfo(); 查看可用处理器的列表