Bitrix Site Manager

ExecuteModuleEvent

mixed
ExecuteModuleEvent(
 array event,
 mixed param1 = NULL,
 mixed param2 = NULL,
 mixed param3 = NULL,
 mixed param4 = NULL,
 mixed param5 = NULL,
 mixed param6 = NULL,
 mixed param7 = NULL,
 mixed param8 = NULL,
 mixed param9 = NULL,
 mixed param10 = NULL
)

The function ExecuteModuleEvent runs an event handler. Returns the return value of an event handler.

Parameters

ParameterDescription
event Array describing one record containing a link between an event and an event handler. Such records are stored in table b_module_to_module. The following keys are possible.
  • ID - record ID;
  • TIMESTAMP_X - date of record modification;
  • SORT - sorting;
  • FROM_MODULE_ID - the module that initialises an event;
  • MESSAGE_ID - event ID;
  • TO_MODULE_ID - the module containing an event handler;
  • TO_CLASS - class with an event handler;
  • TO_METHOD - class method which is the handler itself.
param1,
param2,
... ,
param10
Arbitrary values to be passed to an event handler.

See Also

Example



<?
// check if the forum can be deleted

// the flag that allows or disallows deleting a forum
$bCanDelete = true;

// obtain data on all handlers of "OnBeforeForumDelete" event
// that belongs to the Forum module
$rsEvents = GetModuleEvents("forum", "OnBeforeForumDelete");
while ($arEvent = $rsEvents->Fetch())
{
    // run the scheduled handler of "OnBeforeForumDelete"
    // if false is returned...
    if (ExecuteModuleEvent($arEvent, $del_id)===false)
    {
        // cannot delete forum
        $bCanDelete = false;
        break;
    }
}
?>