Documentation

GetModuleEvents

CDBResult
GetModuleEvents(
 string module_id, 
 string event_id,
 bReturnArray = false
);

The function returns a list of event_id handlers for the module_id as the CDBResult class object.

Equivalent to the method in the new core: Bitrix\Main\EventManager::findEventHandlers.

Function parameters

ParameterDescription Available from version
module_id The module ID.
event_id The event ID.
ReturnArray Optional. By default, returns false. It is recommended to return as true. In this case, an array of parameters will be returned, and not the CDBResult object.

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