/**
  * Object constructor
  *
  * @param   object  An optional KConfig object with configuration options
  */
 public function __construct(KConfig $config)
 {
     parent::__construct($config);
     //Create a command chain object
     $this->_command_chain = $config->command_chain;
     //Mixin the callback mixer if callbacks have been enabled
     if ($config->enable_callbacks) {
         $this->_mixer->mixin(new KMixinCallback(new KConfig(array('mixer' => $this->_mixer, 'command_chain' => $this->_command_chain, 'command_priority' => $config->callback_priority))));
     }
     //Enqueue the event command with a lowest priority to make sure it runs last
     if ($config->dispatch_events) {
         $this->_command_chain->enqueue($config->event, $config->event_priority);
     }
 }
Example #2
0
 /**
  * Object constructor
  *
  * @param   object  An optional KConfig object with configuration options
  */
 public function __construct(KConfig $config)
 {
     parent::__construct($config);
     if (is_null($config->command_chain)) {
         throw new KMixinException('command_chain [KCommandChain] option is required');
     }
     //Create a command chain object
     $this->_command_chain = $config->command_chain;
     //Set the mixer in the config
     $config->mixer = $this->_mixer;
     //Mixin the callback mixer if callbacks have been enabled
     if ($config->enable_callbacks) {
         $this->_mixer->mixin(new KMixinCallback($config));
     }
     //Enqueue the event command with a lowest priority to make sure it runs last
     if ($config->dispatch_events) {
         $this->_mixer->mixin(new KMixinEvent($config));
         //@TODO : Add KCommandChain::getCommand()
         $event = $this->_command_chain->getService('koowa:command.event', array('event_dispatcher' => $config->event_dispatcher));
         $this->_command_chain->enqueue($event, $config->event_priority);
     }
 }
Example #3
0
 /**
  * Adds a content fitler to the content filter chain.
  *
  * @param PlgContentfilterInterface $filter Filter to be added
  *
  * @return PlgContentfilterChain
  */
 public function addFilter(PlgContentfilterInterface $filter)
 {
     $this->_chain->enqueue($filter);
     return $this;
 }