/**
  * Returns whether or not inline editing should be enabled.
  *
  * This method can be called "in general" (no $obj passed) or answered
  * for a very specific object being modified.
  *
  * @param Object $object The Object being edited - could be a Doctrine_Record, Doctrine_Collection 
  * @return boolean
  */
 public function shouldShowEditor($obj = null, $forceRefresh = false)
 {
     $key = $obj === null ? 'generic' : spl_object_hash($obj);
     if (!isset($this->_shouldShowEditor[$key]) || $forceRefresh) {
         $credential = $this->getOption('admin_credential');
         if ($credential) {
             $shouldShow = $this->_user->hasCredential($credential);
         } else {
             // even if no credential were passed, still require a login at least
             $shouldShow = $this->_user->isAuthenticated();
         }
         $event = new sfEvent($this, 'editable_content.should_show_editor', array('user' => $this->_user, 'object' => $obj));
         $this->_dispatcher->filter($event, $shouldShow);
         $this->_shouldShowEditor[$key] = $event->getReturnValue();
     }
     return $this->_shouldShowEditor[$key];
 }
$e = $dispatcher->notifyUntil($event = new sfEvent(new stdClass(), 'foo'));
$t->is($listener->getValue(), 'listenToFooBis', '->notifyUntil() notifies all registered listeners in order and stops if it returns true');
// ->filter()
$t->diag('->filter()');
$listener->reset();
$dispatcher = new sfEventDispatcher();
$dispatcher->connect('foo', array($listener, 'filterFoo'));
$dispatcher->connect('foo', array($listener, 'filterFooBis'));
$e = $dispatcher->filter($event = new sfEvent(new stdClass(), 'foo'), 'foo');
$t->is($e->getReturnValue(), '-*foo*-', '->filter() filters a value');
$t->is($e, $event, '->filter() returns the event object');
$listener->reset();
$dispatcher = new sfEventDispatcher();
$dispatcher->connect('foo', array($listener, 'filterFooBis'));
$dispatcher->connect('foo', array($listener, 'filterFoo'));
$e = $dispatcher->filter($event = new sfEvent(new stdClass(), 'foo'), 'foo');
$t->is($e->getReturnValue(), '*-foo-*', '->filter() filters a value');
class Listener
{
    protected $value = '';
    function filterFoo(sfEvent $event, $foo)
    {
        return "*{$foo}*";
    }
    function filterFooBis(sfEvent $event, $foo)
    {
        return "-{$foo}-";
    }
    function listenToFoo(sfEvent $event)
    {
        $this->value .= 'listenToFoo';
 protected function getWindows()
 {
     return $this->dispatcher->filter(new sfEvent($this, 'dm.admin_homepage.filter_windows'), $this->getDefaultWindows())->getReturnValue();
 }