From c08fc94d850d65f3256c8dcf04a933c599b1408f Mon Sep 17 00:00:00 2001
From: Earl Miles <merlin@logrus.com>
Date: Sat, 2 May 2009 00:56:09 +0000
Subject: [PATCH] A couple more random bugfixes I found.

---
 delegator/plugins/tasks/page.inc              | 18 ++++++++++--------
 includes/content.inc                          |  2 +-
 plugins/content_types/block/block.inc         |  4 ++++
 views_content/plugins/content_types/views.inc |  2 +-
 4 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/delegator/plugins/tasks/page.inc b/delegator/plugins/tasks/page.inc
index d40f030d..774d18c4 100644
--- a/delegator/plugins/tasks/page.inc
+++ b/delegator/plugins/tasks/page.inc
@@ -306,15 +306,17 @@ function delegator_page_execute($subtask_id) {
   $names = delegator_page_get_named_arguments($page->path);
   $bits = explode('/', $page->path);
 
-  foreach ($page->arguments as $name => $argument) {
-    // Optional arguments must be converted to contexts too, if they exist.
-    if ($bits[$names[$name]][0] == '!' && isset($args[$count])) {
-      $argument['keyword'] = $name;
-      ctools_include('context');
-      $context = ctools_context_get_context_from_argument($argument, $args[$count]);
-      $contexts[$context->id] = $context;
+  if ($page->arguments) {
+    foreach ($page->arguments as $name => $argument) {
+      // Optional arguments must be converted to contexts too, if they exist.
+      if ($bits[$names[$name]][0] == '!' && isset($args[$count])) {
+        $argument['keyword'] = $name;
+        ctools_include('context');
+        $context = ctools_context_get_context_from_argument($argument, $args[$count]);
+        $contexts[$context->id] = $context;
+      }
+      $count++;
     }
-    $count++;
   }
 
   if ($function = ctools_plugin_get_function($task, 'page callback')) {
diff --git a/includes/content.inc b/includes/content.inc
index 0f2d85e1..6a4f47e0 100644
--- a/includes/content.inc
+++ b/includes/content.inc
@@ -282,7 +282,7 @@ function ctools_content_render($type, $subtype, $conf, $keywords = array(), $arg
 
     if (!empty($content->title)) {
       // Perform substitutions
-      if (!empty($keywords) || !empty($contexts)) {
+      if (!empty($keywords) || !empty($context)) {
         $content->title = ctools_context_keyword_substitute($content->title, $keywords, $context);
       }
 
diff --git a/plugins/content_types/block/block.inc b/plugins/content_types/block/block.inc
index 92af4fe9..e44c4cce 100644
--- a/plugins/content_types/block/block.inc
+++ b/plugins/content_types/block/block.inc
@@ -66,10 +66,14 @@ function ctools_block_content_type_content_types() {
 function ctools_block_content_type_render($subtype, $conf) {
   list($module, $delta) = _ctools_block_get_module_delta($subtype, $conf);
   $block = (object) module_invoke($module, 'block', 'view', $delta);
+
   if (empty($block)) {
     return;
   }
 
+  $block->module = $module;
+  $block->delta = $delta;
+
   if (isset($block->subject)) {
     $block->title = $block->subject;
   }
diff --git a/views_content/plugins/content_types/views.inc b/views_content/plugins/content_types/views.inc
index 6da2c328..40cfb9ed 100644
--- a/views_content/plugins/content_types/views.inc
+++ b/views_content/plugins/content_types/views.inc
@@ -59,7 +59,7 @@ function views_content_views_content_type_content_types($plugin) {
     $views = views_get_all_views();
 
     foreach ($views as $view) {
-      if (!empty($view->disabled)) {
+      if (empty($view->disabled)) {
         $types[$view->name] = _views_content_views_content_type($view);
       }
     }
-- 
GitLab