Skip to content

Commit

Permalink
CRM-21659 Add hook to CRM_Utils_System::redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
eileenmcnaughton committed Jan 15, 2018
1 parent 6b242b6 commit 5633848
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
17 changes: 17 additions & 0 deletions CRM/Utils/Hook.php
Original file line number Diff line number Diff line change
Expand Up @@ -1635,6 +1635,23 @@ public static function disable() {
);
}

/**
* Alter redirect.
*
* This hook is called when the browser is being re-directed and allows the url
* to be altered.
*
* @param string $url
*
* @return mixed
*/
public static function alterRedirect($url) {
return self::singleton()->invoke(1, $url,
self::$_nullObject, self::$_nullObject,
self::$_nullObject, self::$_nullObject, self::$_nullObject,
'civicrm_alterRedirect'
);
}
/**
* @param $varType
* @param $var
Expand Down
1 change: 1 addition & 0 deletions CRM/Utils/System.php
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@ public static function redirect($url = NULL) {
// this is kinda hackish but not sure how to do it right
$url = str_replace('&', '&', $url);

CRM_Utils_Hook::alterRedirect($url);
// If we are in a json context, respond appropriately
if (CRM_Utils_Array::value('snippet', $_GET) === 'json') {
CRM_Core_Page_AJAX::returnJsonResponse(array(
Expand Down

0 comments on commit 5633848

Please sign in to comment.