From 54e53291c828aaecefef832289654730397f17b8 Mon Sep 17 00:00:00 2001 From: Seamus Lee <seamuslee001@gmail.com> Date: Fri, 10 Jan 2020 18:34:40 +1100 Subject: [PATCH] Resolve issue #742 by documenting new hook_civicrm_alterExternUrl --- docs/hooks/hook_civicrm_alterExternUrl.md | 46 +++++++++++++++++++++++ docs/hooks/list.md | 1 + mkdocs.yml | 1 + 3 files changed, 48 insertions(+) create mode 100644 docs/hooks/hook_civicrm_alterExternUrl.md diff --git a/docs/hooks/hook_civicrm_alterExternUrl.md b/docs/hooks/hook_civicrm_alterExternUrl.md new file mode 100644 index 00000000..4c02109b --- /dev/null +++ b/docs/hooks/hook_civicrm_alterExternUrl.md @@ -0,0 +1,46 @@ +# hook_civicrm_alterExternUrl + +## Summary + +This hook allows you to modify extern urls such as click tracking, tracked opens urls + + + +## Definition + +```php +hook_civicrm_alterExternUrl(\GuzzleHttp\Psr7\UriInterface &$url, $path, $query, $fragment, $absolute, $isSSL) +``` + +## Parameters + +- \GuzzleHttp\Psr7\UriInterface `$url` - Object references the passed URL. + +- string `$path` - the path to the extern php file without the .php extension e.g.`extern/url` + +- string `$query` - URL query parameters as a string + +- string `$fragment` - A fragment identifier (anchor) to append to the link) + +- bool `$absolute` Whether to force the output to be an absolute link (beginning with a URI-scheme such as 'http:'). + +- bool `$isSSL` Whether to redirect to SSL or not format of the URL, NULL to autodetect, TRUE to force to SSL. + +## Returns + +- `NULL` + +## Examples + +```php +function MODULENAME_civicrm_alterExternUrl(\GuzzleHttp\Psr7\UriInterface &$url, $path, $query, $fragment, $absolute, $isSSL) { + if ($path == 'extern/url') { + if ($absolute) { + $path = 'https://example.com'; + } + $path . = '/path/to/url/track/wrapper'; + $url->withPath($path); + $url->withQuery($query); + } +} +``` diff --git a/docs/hooks/list.md b/docs/hooks/list.md index d5290640..165d0e78 100644 --- a/docs/hooks/list.md +++ b/docs/hooks/list.md @@ -146,6 +146,7 @@ This is an overview list of all available hooks, listed by category. * **[hook_civicrm_alterBadge](/hooks/hook_civicrm_alterBadge.md)** - allows you to modify the content and format of name badges. * **[hook_civicrm_alterBarcode](/hooks/hook_civicrm_alterBarcode.md)** - allows you to modify the content that is encoded in barcode. +* **[hook_civicrm_alterExternUrl](/hooks/hook_civicrm_alterExternUrl.md)** - allows you to modify extern urls such as click tracking, tracked opens urls. * **[hook_civicrm_alterLogTables](/hooks/hook_civicrm_alterLogTables.md)** - allows you to amend the specification of the log tables to be created when logging is turned on. * **[hook_civicrm_alterMailingLabelParams](/hooks/hook_civicrm_alterMailingLabelParams.md)** - called to alter the parameters used to generate mailing labels. * **[hook_civicrm_alterPaymentProcessorParams](/hooks/hook_civicrm_alterPaymentProcessorParams.md)** - allows you to modify parameters passed to the payment processor. diff --git a/mkdocs.yml b/mkdocs.yml index 013f4b09..4d946fc9 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -183,6 +183,7 @@ pages: - Uncategorized Hooks: - hook_civicrm_alterBadge: hooks/hook_civicrm_alterBadge.md - hook_civicrm_alterBarcode: hooks/hook_civicrm_alterBarcode.md + - hook_civicrm_alterExternUrl: hooks/hook_civicrm_alterExternUrl.md - hook_civicrm_alterLogTables: hooks/hook_civicrm_alterLogTables.md - hook_civicrm_alterMailingLabelParams: hooks/hook_civicrm_alterMailingLabelParams.md - hook_civicrm_alterPaymentProcessorParams: hooks/hook_civicrm_alterPaymentProcessorParams.md -- GitLab