/** * @see Engine/Events/Event/Streamwide_Engine_Events_Event_Dispatcher#dispatchEvent() */ public function dispatchEvent(Streamwide_Event_Interface $event) { $eventType = $event->getEventType(); if (!$this->isAllowedEventType($eventType)) { return null; } // check to see if we have any context parameters set if (null !== $this->_contextParams) { $areContextParamsOptionsSet = is_array($this->_contextParamsOptions) && !empty($this->_contextParamsOptions); foreach (new ArrayIterator($this->_contextParams) as $key => $value) { $clashSafeName = sprintf('__%s__', $key); // do we have options for the current context parameter? $hasOptions = $areContextParamsOptionsSet && array_key_exists($key, $this->_contextParamsOptions) && is_array($this->_contextParamsOptions[$key]) && !empty($this->_contextParamsOptions[$key]); if ($hasOptions) { $options = $this->_contextParamsOptions[$key]; if (array_key_exists('forEvent', $options)) { if (!is_array($options['forEvent'])) { $options['forEvent'] = array($options['forEvent']); } if (!in_array($eventType, $options['forEvent'])) { // if the current context parameter is not allowed to be injected in // the current event object skip to the next context parameter continue; } } } // empty options or no options set default // to injecting the context parameter into all // events dispatched by the widget $event->setParam($clashSafeName, $value); } } $event->setEventSource($this); return $this->_eventDispatcher->dispatchEvent($event); }