The list of main module events is provided below. To register a handler, specify "main" as the module identifier.
See Also
Events called during page execution
Event | is Called | Method | Available from version |
OnPageStart | at the start of the executable section of the site prologue, after all libraries are included and agents are processed. | | |
OnBeforeProlog | in the executable section of a site prologue (after OnPageStart). | | |
OnProlog | at the beginning of processing the visual aspect of the site prologue. | CAllMain::PrologActions | |
OnEpilog | at the end of site epilog visual part. | | |
OnAfterEpilog | at the end of the executable section of a site epilogue (after OnEpilog). | | |
OnBeforeEndBufferContent | before showing buffered content. | CAllMain::EndBufferContent | |
OnBeforeRestartBuffer | before content buffer reset | CAllMain::RestartBuffer | |
OnEndBufferContent | at the end of buffer content reset. | CAllMain::EndBufferContent | |
Events to handle users and authorization
See Also
Events to handle user groups
Events to hand files and access permissions
Event | is Called | Method | Available from version |
OnBeforeChangeFile | when file is modified immediately before saving. | CAllMain::SaveFileContent | |
OnChangePermissions | when access permissions are modified for file or folder. | CAllMain::RemoveFileAccessPermission | |
OnFileDelete | when deleting file from the tableb_file. | CFile::Delete | |
OnAfterResizeImage | after image size is modified | CFile::ResizeImageGet | |
OnBeforeChangeFile | prior modifying the file | CMain::SaveFileContent | |
OnBeforeResizeImage | prior to modifying image size | CFile::ResizeImageGet | |
OnFileCopy | when copying the file | CFile::CopyFile | |
OnFileSave | when saving file
Example: when saved, original image resolution is reduced to 1920*1920
AddEventHandler("main",'OnFileSave','OnFileSave');
function OnFileSave(&$arFile, $fileName, $module)
{
$arNewFile = CIBlock::ResizePicture($arFile, array("WIDTH" => 1920, "HEIGHT" => 1920, "METHOD" => "resample"));
if(is_array($arNewFile))
$arFile = $arNewFile;
else
$APPLICATION->throwException("Image scale Image scaling error in the property\"Files\":".$arNewFile);
}
| CFile::SaveFile | |
OnGetFileSRC | when getting image address | CFile::GetFileSRC | |
OnMakeFileArray | when creating an array, describing the file | CFile::MakeFileArray | |
OnSearchGetFileContent | when indexing by search module | CUserTypeFile::__GetFileContent | |
OnTaskOperationsChanged | when access permission level | CTask::SetOperations | |
Events to handle mail message templates
Events to handle sites
Events to handle languages
Events to handle control panel and administrative section
See Also
Events to handle ratings
Event | is Called | Method | Available from version |
OnAddRatingVote | when adding a vote for content. | CRatings::Add | |
OnAfterCheckAllowVote | when checking access permissions for voting. Prior to adding a vote, array type array('RESULT' => false, 'ERROR_TYPE' => 'error type', 'ERROR_MSG' => 'error description') must be returned - vote will not be accounted for. If true is returned, the vote will be accounted. | CRatingRule::Add | |
OnCancelRatingVote | when cancelling previously cast vote for content. | CRatings::Update | |
OnAfterUpdateRatingRule | when updating the rating processing rule | CRatingRule::Update | |
OnBeforeDeleteRating | prior to deleting of rating | CRatings::Delete | |
OnBeforeDeleteRatingRule | prior to deleting of rating processing rule | CRatingRule::Delete | |
OnGetRatingContentOwner | when adding a vote to determine the content author ID | CRatings::AddRatingVote | |
OnGetRatingRuleConfigs | when generating page to add (edit) processing rules to get rules settings | CRatingRule::GetRatingRuleConfigs | |
OnGetRatingRuleObjects | when calling rating processing rules | CRatingRule::GetRatingRuleObjects | |
OnGetRatingsConfigs | when generating page to add (edit) processing rules to get vote objects. These rules can be applied to these voting objects | CRatings::GetRatingConfigs | |
OnGetRatingsObjects | when generating page to add (edit) ratings to get rating component settings | CRatings::GetRatingObjects | |
Events to handle text parsing
Event | is Called | Method | Available from version |
TextParserAfter | after parsing | CTextParser::convertText | |
TextParserAfterTags | after parsing of tags | CTextParser::convertText | |
TextParserBefore | before parsing | CTextParser::convertText | |
TextParserBeforePattern | before parsing | CTextParser::convertText | |
TextParserBeforeTags | before parsing of tags | CTextParser::convertText | |
TextParserVideoConvert | when parsing video tag | CTextParser::convert_video | |
Events to handle system updates
Event | is Called | Method | Available from version |
OnUpdatesInstalled | after updates are installed. Has a single parameter: array type:
Array (
"successModules" => $arSuccessModules,
"loadModules" => $arLoadModules,
"errorModules" => $arErrorModules,
"modulesUpdates" => $arModulesUpdates | CUpdateOutput::ShowBlockInfo | |
OnModuleUpdate | after the module update | CUpdateClientPartner::UpdateStepModules | |
Events to install modules
Event | is Called | Method | Available from version |
OnAfterRegisterModule | after module registration | RegisterModule | |
OnAfterUnRegisterModule | after module is uninstalled | UnRegisterModule | |
Events to handle user fields
Event | is Called | Method | Available from version |
OnUserTypeBuildList | when building list of user fields | CUserTypeManager::GetUserType | |
OnUserTypeRightsCheck | when checking access permissions for user fields | GetRights | |
OnAfterFetch | after a selection fetching | | |
onAfterUserTypeUpdate | after user field. Arguments:
- $arFields - array of fields after update
- $ID - field ID.
| CUserTypeEntity | |
OnAfterUserTypeDelete | after user field is deleted. Arguments:
- $arFields - array of fields for deleted element
- $ID - field ID.
| CUserTypeEntity | |
Other events
Event | is Called | Method | Available from version |
OnAutoSaveRestore | when resorting autosaved data | CAutoSave::_Restore | |
OnBeforeLocalRedirect | before redirect | LocalRedirect | |
OnLocalRedirect | when redirect | LocalRedirect | |
OnCheckListGet | when sending a checklist | CCheckList::__construct | |
onAfterAjaxResponse | after Ajax request processing to the component in the Ajax-mode | ExecuteEvents | |
OnAfterShortUriAdd | after adding a short URL | CBXShortUri::Add | |
OnBeforeShortUriDelete | before deleting a short URL | CBXAllShortUri::Delete | |