Author Topic: Request for additional hook  (Read 3696 times)

wal5hy

  • Newbie
  • *
  • Posts: 3
    • View Profile
Request for additional hook
« on: January 22, 2010, 12:55:25 pm »
Hi All,

I'm developing a plugin for fengoffice which provides the ability to add a location to an event using google maps.

I'm integrating with Feng Office using the following hooks:

object_edit_categories : add an additional category to edit location to ProjectEvent

render_object_properties : when viewing an event add a static map to the properties section

object_validate : when an event is being saved, validate my location object too, if it doesnt validate then the event object wont save either, great!

My problem is that my location database table needs to use the ProjectEvent id as a foreign key, so i can't save my location object before the Projectevent has been saved and given an Id.

Really need an extra hook:  'after_object_save' to be added to DataObject.class.php line 420 so it reads something like this:

     function save() {
       $errors = $this->doValidate();
      
       if(is_array($errors)) {
         throw new DAOValidationError($this, $errors);
       } // if
      
       Hook::fire('before_object_save', $this, $ret);
       $didSave = $this->doSave();
          Hook::fire('after_object_save', $this, $didSave);
       return $didSave;
     } // save

Unless im missing something?

I'm developing the plugin for a client but hope to opensource it and add it to the feng office plugins list in the future. Will write a blog post describing how to write a plugin too if anyone's interested (although i may be missing a few things still at the moment)

Pet

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 638
  • Always mining for solutions!
    • View Profile
    • The Bet!
Re: Request for additional hook
« Reply #1 on: January 22, 2010, 09:05:11 pm »
If you write that blog post about writing plugins, I strongly suggest you add it to the wiki, so others might benefit from it.
Support OpenGoo - Sponsor a Feature! | Follow me on Twitter | OG Support Chat | Did you turn debugging on?

wal5hy

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Request for additional hook
« Reply #2 on: January 23, 2010, 12:37:36 pm »
Yup not a problem I will add it to the wiki.

cabeza

  • Administrator
  • Hero Member
  • *****
  • Posts: 1004
    • View Profile
    • Feng Office
Re: Request for additional hook
« Reply #3 on: April 02, 2010, 01:12:24 pm »
Any news on this wal5hy?