You need to add a button to the discount change form. Having rummaged in the code, I found the OnAdminContextMenuShow handler. How can I subscribe to it from my module? I found only one way in the documentation: register the listener in the /bitrix/php_interface/init.php listener using the AddEventHandler function. How to automate it?

    1 answer 1

    To register an event in its module, RegisterModuleDependences used.
    example:
    RegisterModuleDependences( "iblock", // ΠΌΠΎΠ΄ΡƒΠ»ΡŒ Π² ΠΊΠΎΡ‚ΠΎΡ€ΠΎΠΌ происходит событиС "OnBeforeIBlockElementUpdate", // Π½Π°Π·Π²Π°Π½ΠΈΠ΅ события "mymodule", // Π½Π°Π·Π²Π°Π½ΠΈΠ΅ вашСго модуля "cMainRPJ",// имя вашСго класса ΠΎΠ±Ρ€Π°Π±ΠΎΡ‚Ρ‡ΠΈΠΊΠ° "onBeforeElementUpdateHandler" // имя вашСго ΠΌΠ΅Ρ‚ΠΎΠ΄Π° ΠΎΠ±Ρ€Π°Π±ΠΎΡ‚Ρ‡ΠΈΠΊΠ° );

    All this should be in the method when installing the DoInstall module DoInstall