Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
C
Core
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 933
    • Issues 933
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Operations
    • Operations
    • Incidents
  • Analytics
    • Analytics
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
  • Development
  • Core
  • Issues
  • #1100

Closed
Open
Opened Jul 03, 2019 by Andrei Mondoc@andreiDeveloper

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.

Drupal 8 and WordPress offer the possibility of extending their REST endpoints, and it seems Joomla does so too although unofficially? (REST API for Joomla! and cAPI Core REST API for Joomla!)

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.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
5.23.0
Milestone
5.23.0
Assign milestone
Time tracking
None
Due date
None
Reference: dev/core#1100