[geeklog-devel] Plugin API: Extend Admin's story editor
dirk at haun-online.de
Sat Feb 26 08:26:00 EST 2005
For two clients now, I needed a way to extend the Admin's story editor.
I've added two plugin API functions for this: One that is called before
the story editor is displayed (so that the plugin can provide its items
to be displayed in the editor) and one when the story is saved.
I'll talk about the former at another time. The latter is the more
interesting one anyway.
The way I've currently implemented it is that BEFORE the call to DB_save
that actually saves the story, the new plugin API function is called,
giving the plugins a chance to manipulate the data that goes into the
story and save their own data.
However, I've been thinking if it wouldn't make more sense to do the API
call AFTER the story has been saved. Plugins could still manipulate the
story's data if they needed to (read it and write it back) and it would
also ensure that the story has actually been saved.
Notifying plugins that a story has been saved/changed would also go
nicely with the idea of the forum replacing the comments section, <http:/
func=detail&aid=249&group_id=6&atid=108>, as well as with this patch,
func=detail&aid=382&group_id=6&atid=107>, to pre-populate some comments.
So the call would be something like
and the plugin could return an error message in case something went wrong
(in which case admin/story.php would call up the story editor again and
display that error message).
The only problem (but one that also exists when calling the API function
before the DB_save) would be if plugin #1 already did something based on
the new/changed story and then plugin #2 reports an error. Plugins using
that API function would have to be prepared for that case then.
More information about the geeklog-devel