Documentation

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 runs an event handler. Returns the return value of a specific event handler.

Function parameters

ParameterDescription Available from version
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 when record is modified
  • 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 that contains 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

Examples of use

<?
// 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 returns false...
    if (ExecuteModuleEvent($arEvent, $del_id)===false)
    {
        // cannot delete forum
        $bCanDelete = false;
        break;
    }
}
?>


© «Bitrix24», 2001-2024
Up