From 4afa676db4630537c08525f59d07f262bdd03545 Mon Sep 17 00:00:00 2001
From: Marc van Gend <marc@triquanta.nl>
Date: Fri, 8 Feb 2013 09:59:47 +0100
Subject: [PATCH] prevent warning when no fieldblocks are set

---
 fieldblock.module | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/fieldblock.module b/fieldblock.module
index b197f75..b4adcb3 100644
--- a/fieldblock.module
+++ b/fieldblock.module
@@ -72,15 +72,17 @@ function fieldblock_block_info() {
   $blocks = array();
 
   $fieldblocks = fieldblock_get_block_list();
-  foreach ($fieldblocks as $fieldblock_id => $fieldblock) {
-    $blocks[$fieldblock_id] = array(
-      'info' => t('@field (field in @type: @bundle)', array(
-        '@field' => $fieldblock['field_label'],
-        '@type' => $fieldblock['type'],
-        '@bundle' => $fieldblock['bundle_label'],
-      )),
-      'cache' => DRUPAL_CACHE_PER_PAGE,
-    );
+  if ($fieldblocks) {
+    foreach ($fieldblocks as $fieldblock_id => $fieldblock) {
+      $blocks[$fieldblock_id] = array(
+        'info' => t('@field (field in @type: @bundle)', array(
+          '@field' => $fieldblock['field_label'],
+          '@type' => $fieldblock['type'],
+          '@bundle' => $fieldblock['bundle_label'],
+        )),
+        'cache' => DRUPAL_CACHE_PER_PAGE,
+      );
+    }
   }
 
   return $blocks;
-- 
GitLab