$config = CRM_Core_Config::singleton();
$ufDSN = CRM_Utils_SQL::autoSwitchDSN($config->userFrameworkDSN);
- $dbBackdrop = DB::connect($ufDSN);
- if (DB::isError($dbBackdrop)) {
- throw new CRM_Core_Exception("Cannot connect to Backdrop database via $ufDSN, " . $dbBackdrop->getMessage());
+ try {
+ $dbBackdrop = DB::connect($ufDSN);
+ }
+ catch (Exception $e) {
+ throw new CRM_Core_Exception("Cannot connect to Backdrop database via $ufDSN, " . $e->getMessage());
}
$account = $userUid = $userMail = NULL;
require_once "$cmsPath/core/includes/config.inc";
backdrop_bootstrap(BACKDROP_BOOTSTRAP_FULL);
- // Explicitly setting error reporting, since we cannot handle Backdrop
- // related notices.
- error_reporting(1);
if (!function_exists('module_exists') || !module_exists('civicrm')) {
if ($throwError) {
echo '<br />Sorry, could not load Backdrop bootstrap.';
return ['ufAccessURL' => url('admin/config/people/permissions')];
}
+ /**
+ * Get the CRM database as a 'prefix'.
+ *
+ * This returns a string that can be prepended to a query to include a CRM table.
+ *
+ * However, this string should contain backticks, or not, in accordance with the
+ * CMS's drupal views expectations, if any.
+ */
+ public function getCRMDatabasePrefix(): string {
+ return str_replace(parent::getCRMDatabasePrefix(), '`', '');
+ }
+
+ /**
+ * Return the CMS-specific UF Group Types for profiles.
+ * @return array
+ */
+ public function getUfGroupTypes() {
+ return [
+ 'User Registration' => ts('Backdrop User Registration'),
+ 'User Account' => ts('View/Edit Backdrop User Account'),
+ ];
+ }
+
}