From: Seamus Lee Date: Tue, 5 May 2020 10:07:57 +0000 (+1000) Subject: dev/core#1742 Expose CiviCRM Database details for views configuration in Drupal 8... X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=9a8fe7105043fb08f50b916e45a2ed814789bb1e;p=civicrm-core.git dev/core#1742 Expose CiviCRM Database details for views configuration in Drupal 8 as well as in Drupal 7 and Backdrop --- diff --git a/CRM/Admin/Form/Setting/UF.php b/CRM/Admin/Form/Setting/UF.php index bf6a6eb5c7..62c12870f9 100644 --- a/CRM/Admin/Form/Setting/UF.php +++ b/CRM/Admin/Form/Setting/UF.php @@ -56,9 +56,7 @@ class CRM_Admin_Form_Setting_UF extends CRM_Admin_Form_Setting { } } - if ( - function_exists('module_exists') && - module_exists('views') && + if ($config->userSystem->viewsExists() && ( $config->dsn != $config->userFrameworkDSN || !empty($drupal_prefix) ) diff --git a/CRM/Utils/System/Base.php b/CRM/Utils/System/Base.php index 233390e4f3..3fad89433a 100644 --- a/CRM/Utils/System/Base.php +++ b/CRM/Utils/System/Base.php @@ -986,4 +986,13 @@ abstract class CRM_Utils_System_Base { return NULL; } + /** + * Determine if the Views module exists. + * + * @return bool + */ + public function viewsExists() { + return FALSE; + } + } diff --git a/CRM/Utils/System/Drupal8.php b/CRM/Utils/System/Drupal8.php index 49d39ca6d7..82fe4d85e4 100644 --- a/CRM/Utils/System/Drupal8.php +++ b/CRM/Utils/System/Drupal8.php @@ -803,4 +803,16 @@ class CRM_Utils_System_Drupal8 extends CRM_Utils_System_DrupalBase { return user_role_names(); } + /** + * Determine if the Views module exists. + * + * @return bool + */ + public function viewsExists() { + if (\Drupal::moduleHandler()->moduleExists('views')) { + return TRUE; + } + return FALSE; + } + } diff --git a/CRM/Utils/System/DrupalBase.php b/CRM/Utils/System/DrupalBase.php index 2dd06c9e7e..4aa3b97808 100644 --- a/CRM/Utils/System/DrupalBase.php +++ b/CRM/Utils/System/DrupalBase.php @@ -687,4 +687,16 @@ abstract class CRM_Utils_System_DrupalBase extends CRM_Utils_System_Base { return array_combine(user_roles(), user_roles()); } + /** + * Determine if the Views module exists. + * + * @return bool + */ + public function viewsExists() { + if (function_exists('module_exists') && module_exists('views')) { + return TRUE; + } + return FALSE; + } + }