Fix for query when block is not included.
authoryoung hahn
Tue, 14 Sep 2010 22:16:28 +0000 (22:16 +0000)
committeryoung hahn
Tue, 14 Sep 2010 22:16:28 +0000 (22:16 +0000)
plugins/context_reaction_block.inc

index 7a7b072..954d657 100644 (file)
@@ -372,16 +372,18 @@ class context_reaction_block extends context_reaction {
       drupal_alter('context_block_info', $block_info);
 
       // Gather only region info from the database.
-      $theme_key = variable_get('theme_default', 'garland');
-      $result = db_select('block')
-        ->fields('block', array('module','weight','delta','region'))
-        ->condition('theme', $theme_key)
-        ->condition('status', 1)
-        ->execute();
-      foreach ($result as $row) {
-        if (isset($block_info["{$row->module}-{$row->delta}"])) {
-          $block_info["{$row->module}-{$row->delta}"]->weight = $row->weight;
-          $block_info["{$row->module}-{$row->delta}"]->region = $row->region;
+      if (module_exists('block')) {
+        $theme_key = variable_get('theme_default', 'garland');
+        $result = db_select('block')
+          ->fields('block', array('module','weight','delta','region'))
+          ->condition('theme', $theme_key)
+          ->condition('status', 1)
+          ->execute();
+        foreach ($result as $row) {
+          if (isset($block_info["{$row->module}-{$row->delta}"])) {
+            $block_info["{$row->module}-{$row->delta}"]->weight = $row->weight;
+            $block_info["{$row->module}-{$row->delta}"]->region = $row->region;
+          }
         }
       }
     }