FeatureModule Hooks
A FeatureModule can handle a hook by implementing a function named the same as the hook with the signature matching the data returned. In this case we are handling the AfterRetsUpdate event.
namespace SiteMap\Extensibility; class SiteMapHooks implements \Mbx\Entity\IMbxHooks{ public static function GetInstance(){ return new SiteMapHooks(); } public function AfterRetsUpdate($data){ if(!defined('MBX_CODE_API')) define ('MBX_CODE_API', 1); $invoke = array(); $invoke['controller'] = 'SiteMap'; $invoke['action'] = 'RenderSiteMap'; $invoke['data'] = $data; include_once MBX_BASE_SYSTEM_PATH.'index.php'; \Mbx\System\API\ApiController($invoke); } }
Note that this method reuses an API method. In order to do that MBX_CODE_API is defined to 1.
The class must implement \Mbx\Entity\IMbxHooks. Implementing GetInstance() will satisfy that.
The namespace must be YourFeatureModuleName\Extensibility.