From f63c106999870905a01d8c194947511b5e3ed0a7 Mon Sep 17 00:00:00 2001 From: Sean Madsen Date: Fri, 17 Mar 2017 21:46:35 -0600 Subject: [PATCH] CRM-20300 - Fix in-app documentation links --- CRM/Utils/System.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/CRM/Utils/System.php b/CRM/Utils/System.php index e78b144882..0498c5f7ee 100644 --- a/CRM/Utils/System.php +++ b/CRM/Utils/System.php @@ -1237,7 +1237,7 @@ class CRM_Utils_System { */ public static function getDocBaseURL() { // FIXME: move this to configuration at some stage - return 'http://book.civicrm.org/'; + return 'http://docs.civicrm.org/'; } /** @@ -1283,6 +1283,7 @@ class CRM_Utils_System { } else { $docBaseURL = self::getDocBaseURL(); + $page = self::formatDocUrl($page); } return $docBaseURL . str_replace(' ', '+', $page); } @@ -1321,6 +1322,7 @@ class CRM_Utils_System { } else { $docBaseURL = self::getDocBaseURL(); + $params['page'] = self::formatDocUrl($params['page']); } if (!isset($params['title']) or $params['title'] === NULL) { @@ -1348,6 +1350,18 @@ class CRM_Utils_System { } } + /** + * Add language and version parameters to the doc url. + * + * Note that this function may run before CiviCRM is initialized and so should not call ts() or perform any db lookups. + * + * @param $url + * @return mixed + */ + public static function formatDocUrl($url) { + return preg_replace('#^user/#', 'user/en/4.6/', $url); + } + /** * Get the locale set in the hosting CMS. * -- 2.25.1