예제 #1
0
    /**
     * Load runtime hook listeners.
     *
     * @return Zikula_HookManager
     */
    public function loadRuntimeHandlers()
    {
        $handlers = $this->storage->getRuntimeHandlers();
        foreach ($handlers as $handler) {
            if ($handler['serviceid']) {
                $callable = $this->factory->buildService($handler['serviceid'], $handler['classname'], $handler['method']);
            } else {
                $callable = array($handler['classname'], $handler['method']);
            }

            try {
                $this->eventManager->attach($handler['eventname'], $callable);
            } catch (InvalidArgumentException $e) {
                throw new Zikula_HookManager_Exception_RuntimeException("Hook event handler could not be attached because %s", $e->getMessage(), 0, $e);
            }
        }
        return $this;
    }
예제 #2
0
 /**
  * Attach handler with EventManager.
  *
  * @return void
  */
 public function attach()
 {
     foreach ($this->eventNames as $callable) {
         $this->eventManager->attach($callable['name'], array($this, $callable['method']), $callable['weight']);
     }
 }