GenCode - Optionaly allow direct control over civicrm.config.php template
[civicrm-core.git] / CRM / Core / CodeGen / Config.php
index c01834d3bbcdcdfd3329246be400f207734bc1ba..aa50e059577a81794bd8228a966167b73b0d0910 100644 (file)
@@ -4,18 +4,19 @@
  * Generate configuration files
  */
 class CRM_Core_CodeGen_Config extends CRM_Core_CodeGen_BaseTask {
+
   public function run() {
     $this->setupCms();
   }
 
   public function setupCms() {
-    if (!in_array($this->config->cms, array(
+    if (!in_array($this->config->cms, [
       'backdrop',
       'drupal',
       'drupal8',
       'joomla',
       'wordpress',
-    ))) {
+    ])) {
       echo "Config file for '{$this->config->cms}' not known.";
       exit();
     }
@@ -38,7 +39,11 @@ class CRM_Core_CodeGen_Config extends CRM_Core_CodeGen_BaseTask {
    *   path to config template
    */
   public function findConfigTemplate($cms) {
-    $candidates = array();
+    if (getenv('GENCODE_CONFIG_TEMPLATE')) {
+      return getenv('GENCODE_CONFIG_TEMPLATE');
+    }
+
+    $candidates = [];
     switch ($cms) {
       case 'backdrop':
         // FIXME!!!!
@@ -56,6 +61,7 @@ class CRM_Core_CodeGen_Config extends CRM_Core_CodeGen_BaseTask {
       case 'drupal8':
         $candidates[] = "../../modules/civicrm/civicrm.config.php.drupal";
         $candidates[] = "../../../modules/civicrm/civicrm.config.php.drupal";
+        $candidates[] = "../../../modules/civicrm-drupal/civicrm.config.php.drupal";
         break;
 
       case 'wordpress':