dev/drupal#19 Drupal8: fix bootstrap when used by the REST API
authorMathieu Lutfy <mathieu@symbiotic.coop>
Wed, 22 May 2019 23:59:28 +0000 (19:59 -0400)
committerMathieu Lutfy <mathieu@bidon.ca>
Wed, 22 May 2019 23:59:28 +0000 (19:59 -0400)
CRM/Utils/System/Drupal8.php

index f1df28970aeec08e8e2f5cabb2130f62497356f1..b832eee6825c683b00b93aa53ce91dca7b3807d8 100644 (file)
@@ -659,7 +659,7 @@ class CRM_Utils_System_Drupal8 extends CRM_Utils_System_DrupalBase {
    */
   public function getCurrentLanguage() {
     // Drupal might not be bootstrapped if being called by the REST API.
-    if (!class_exists('Drupal')) {
+    if (!class_exists('Drupal') || !\Drupal::hasContainer()) {
       return NULL;
     }
 
@@ -706,7 +706,7 @@ class CRM_Utils_System_Drupal8 extends CRM_Utils_System_DrupalBase {
     }
 
     // Drupal might not be bootstrapped if being called by the REST API.
-    if (!class_exists('Drupal')) {
+    if (!class_exists('Drupal') || !\Drupal::hasContainer()) {
       return NULL;
     }