From 348c3cc746bf733a3f44a72377fb1dbb90c215e7 Mon Sep 17 00:00:00 2001
From: Jorrit Schippers <jorrit@161217.no-reply.drupal.org>
Date: Thu, 4 Apr 2013 20:33:40 +0200
Subject: [PATCH] Issue #954942 by Jorrit: Fixed "Call to undefined method
 stdClass::is_type()" when using a bundle argument.

---
 includes/context.inc |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/includes/context.inc b/includes/context.inc
index 93be748..a7571d2 100644
--- a/includes/context.inc
+++ b/includes/context.inc
@@ -169,7 +169,12 @@ class ctools_context_required {
 
   function select($contexts, $context) {
     if (!is_array($contexts)) {
-      $contexts = array($contexts);
+      if (is_object($contexts) && $contexts instanceof ctools_context) {
+        $contexts = array($contexts->id => $contexts);
+      }
+      else {
+        $contexts = array($contexts);
+      }
     }
 
     // If we had requested a $context but that $context doesn't exist
@@ -1588,7 +1593,9 @@ function ctools_access_add_restrictions($settings, $contexts) {
       $required_context = isset($plugin['required context']) ? $plugin['required context'] : array();
       $context = isset($test['context']) ? $test['context'] : array();
       $contexts = ctools_context_select($contexts, $required_context, $context);
-      $function($test['settings'], $contexts);
+      if ($contexts !== FALSE) {
+        $function($test['settings'], $contexts);
+      }
     }
   }
 }
-- 
1.7.10.4

