Merge pull request #11757 from eileenmcnaughton/manual
[civicrm-core.git] / CRM / Utils / Hook / Drupal8.php
index de0d8c4e77edffb1a365bb7480ee191163ef77bf..0c505c16a0c4ba6e90a7a91959edf0139108bc8c 100644 (file)
@@ -3,7 +3,7 @@
  +--------------------------------------------------------------------+
  | CiviCRM version 4.7                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2017                                |
+ | Copyright CiviCRM LLC (c) 2004-2018                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -28,7 +28,7 @@
 /**
  *
  * @package CiviCRM_Hook
- * @copyright CiviCRM LLC (c) 2004-2017
+ * @copyright CiviCRM LLC (c) 2004-2018
  */
 class CRM_Utils_Hook_Drupal8 extends CRM_Utils_Hook_DrupalBase {
 
@@ -36,7 +36,7 @@ class CRM_Utils_Hook_Drupal8 extends CRM_Utils_Hook_DrupalBase {
    * {@inheritdoc}
    */
   protected function getDrupalModules() {
-    if (class_exists('\Drupal')) {
+    if (class_exists('\Drupal') && \Drupal::hasContainer()) {
       return array_keys(\Drupal::moduleHandler()->getModuleList());
     }
   }