From: Coleman Watts Date: Wed, 12 Oct 2016 17:00:26 +0000 (-0400) Subject: CRM-19338 - Add language and version params to doc urls X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=c15f87c1013fb1b61d7e484589915d8c02023b74;p=civicrm-core.git CRM-19338 - Add language and version params to doc urls --- diff --git a/CRM/Utils/System.php b/CRM/Utils/System.php index d8f94e0815..77e9226723 100644 --- a/CRM/Utils/System.php +++ b/CRM/Utils/System.php @@ -1257,7 +1257,7 @@ class CRM_Utils_System { */ public static function getDocBaseURL() { // FIXME: move this to configuration at some stage - return 'http://book.civicrm.org/'; + return 'https://docs.civicrm.org/'; } /** @@ -1303,6 +1303,7 @@ class CRM_Utils_System { } else { $docBaseURL = self::getDocBaseURL(); + $page = self::formatDocUrl($page); } return $docBaseURL . str_replace(' ', '+', $page); } @@ -1341,6 +1342,7 @@ class CRM_Utils_System { } else { $docBaseURL = self::getDocBaseURL(); + $params['page'] = self::formatDocUrl($params['page']); } if (!isset($params['title']) or $params['title'] === NULL) { @@ -1368,6 +1370,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/((\w\w/)?stable/)?#', 'user/en/stable/', $url); + } + /** * Exit with provided exit code. * diff --git a/templates/CRM/Admin/Page/ConfigTaskList.tpl b/templates/CRM/Admin/Page/ConfigTaskList.tpl index b10b1a6ef6..1070571eee 100644 --- a/templates/CRM/Admin/Page/ConfigTaskList.tpl +++ b/templates/CRM/Admin/Page/ConfigTaskList.tpl @@ -167,7 +167,7 @@ {ts}Online event registration and participant tracking.{/ts} - {docURL page="user/membership/introduction-to-memberships" text="CiviMember"} + {docURL page="user/membership/what-is-civimember" text="CiviMember"} {ts}Online signup and membership management.{/ts}