dev/core#1742 Expose CiviCRM Database details for views configuration in Drupal 8...
authorSeamus Lee <seamuslee001@gmail.com>
Tue, 5 May 2020 10:07:57 +0000 (20:07 +1000)
committerSeamus Lee <seamuslee001@gmail.com>
Tue, 5 May 2020 10:07:57 +0000 (20:07 +1000)
CRM/Admin/Form/Setting/UF.php
CRM/Utils/System/Base.php
CRM/Utils/System/Drupal8.php
CRM/Utils/System/DrupalBase.php

index bf6a6eb5c71e2e0800b865a70036e823ff94e111..62c12870f97426571511596029eb8003f01eec32 100644 (file)
@@ -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)
       )
index 233390e4f3ec3b9877d269c330262b55d93b39d0..3fad89433aabc8cc1b1bcb214a42099c476077ba 100644 (file)
@@ -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;
+  }
+
 }
index 49d39ca6d778079ff63932d70d41ecb0bf2d16e2..82fe4d85e47fd4f8b6442937310e08d081b29574 100644 (file)
@@ -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;
+  }
+
 }
index 2dd06c9e7e1eb5655c6aa202997850436c561348..4aa3b97808b5fe682fe0130e07cae68c81ba6fe4 100644 (file)
@@ -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;
+  }
+
 }