php - Bolt CMS Events -


i working save event having limited luck.

i have tried 2 ways limited success.

1) can either never function fire,

2) not sure pass function method two.

all trying dump event information out on content save.any appreciated, loving cms

attempt 1 -- never runs function @ all

class extension extends baseextension {   public function initialize() {     $this->addcss('assets/extension.css');     $this->addjavascript('assets/start.js', true);      $this->app['dispatcher']->addlistener(\bolt\events\storageevents::post_save, 'postsave');  }  function postsave(\bolt\storageevent $event) {     dump($event); } 

attempt 2 -- input parameter?

class extension extends baseextension {   public function initialize() {     $this->addcss('assets/extension.css');     $this->addjavascript('assets/start.js', true);      $this->app['dispatcher']->addlistener(\bolt\events\storageevents::post_save,$this->postsave($this->?????));  }  function postsave(\bolt\storageevent $event) {     dump($event); } 

the parameter needed php callback format this:

$this->app['dispatcher']->addlistener(\bolt\events\storageevents::post_save, array($this, 'postsave')); 

that syntax saying run postsave method within current class. work example number 1.

now can dump event in postsave method , see results.


Comments