diff --git a/CRM/Utils/System/Drupal8.php b/CRM/Utils/System/Drupal8.php index f1df28970aee..b832eee6825c 100644 --- a/CRM/Utils/System/Drupal8.php +++ b/CRM/Utils/System/Drupal8.php @@ -659,7 +659,7 @@ public function postURL($action) { */ 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 @@ public function languageNegotiationURL($url, $addLanguagePart = TRUE, $removeLan } // Drupal might not be bootstrapped if being called by the REST API. - if (!class_exists('Drupal')) { + if (!class_exists('Drupal') || !\Drupal::hasContainer()) { return NULL; }