Proposal to add a new hook_civicrm_alterExternUrl
There's been talks about deprecating all
extern scripts in favour of CMS REST endpoints or use CiviCRM's routing, and along the way helping other issues like CMS bootstrapping, base paths, and session management.
This seems to me like a sensible way forward, hence my proposal to add a
hook_civicrm_alterExternUrl something along the lines of:
// Create an event object. $event = GenericHookEvent::create(array( 'type' => 'cxn', // replacing with ipn|extern|soap|pxIPN|etc. 'civiURL' => &$civiUrl, 'url' => rtrim($civiUrl, '/') . '/extern/cxn.php', ); /** * Allow filtering of extern URL. * * @since ... * * @param string $hook_name The dispatched hook name. * @param object $hook_event The dispatched hook event object. */ Civi::service('dispatcher')->dispatch('hook_alterExternUrl', $event); return $event->url;
I have completed the REST endpoints integration for WordPress and I remember someone (in Mattermost) mentioning they were/are doing the same for Drupal 8. In order to start testing and integrating those endpoints this hook would a good transition.
Any feedback is appreciated, thanks.