--- PartialHelper.php.orig	2007-03-21 11:28:59.998217215 +0100
+++ PartialHelper.php	2007-03-21 11:42:55.308217215 +0100
@@ -20,7 +20,7 @@
 /**
  * Evaluates and echoes a component slot.
  * The component name is deduced from the definition of the view.yml
- * For a variable to be accessible to the component and its partial, 
+ * For a variable to be accessible to the component and its partial,
  * it has to be passed in the second argument.
  *
  * <b>Example:</b>
@@ -76,7 +76,7 @@
 
 /**
  * Evaluates and echoes a component.
- * For a variable to be accessible to the component and its partial, 
+ * For a variable to be accessible to the component and its partial,
  * it has to be passed in the third argument.
  *
  * <b>Example:</b>
@@ -393,24 +393,7 @@
  */
 function include_slot($name)
 {
-  $context = sfContext::getInstance();
-  $slots = $context->getResponse()->getParameter('slots', array(), 'symfony/view/sfView/slot');
-
-  if (sfConfig::get('sf_logging_enabled'))
-  {
-    $context->getLogger()->info(sprintf('{PartialHelper} get slot "%s"', $name));
-  }
-
-  if (isset($slots[$name]))
-  {
-    echo $slots[$name];
-
-    return true;
-  }
-  else
-  {
-    return false;
-  }
+  echo get_slot($name);
 }
 
 /**
@@ -437,3 +420,37 @@
 
   return isset($slots[$name]) ? $slots[$name] : '';
 }
+
+/**
+ * Remove a slot if present.
+ *
+ * <b>Example:</b>
+ * <code>
+ *  echo remove_slot('navigation');
+ * </code>
+ *
+ * @param  string slot name
+ * @return boolean true, if the slot is removed
+ * @see    has_slot, include_slot, get_slot
+ * @author Emiliano Gabrielli <emiliano.gabrielli@dearchitettura.com>
+ */
+function remove_slot($name)
+{
+  $ret = false;
+  $log = sfConfig::get('sf_logging_enabled');
+
+  $context = sfContext::getInstance();
+  $slots = $context->getResponse()->getParameter('slots', array(), 'symfony/view/sfView/slot');
+
+  if ( array_key_exists($name, $slots) )
+  {
+    unset($slots[$name]);
+    $ret = $context->getResponse()->setParameter('slots', $slots, 'symfony/view/sfView/slot');
+    if ($log)
+    {
+      $context->getLogger()->info(sprintf('{PartialHelper} removed slot "%s"', $name));
+    }
+  }
+  return $ret;
+}
+

