Module API rewrite
Posted: Sun Jan 02, 2005 4:01 pm
0.9 is going to bring about a module API reorganization. I actually want to do an object oriented API, instead of the callback one that's currently in place. An idea of what I have in mind is similar to how Nucleus CMS does their plugin API. It's documented here: http://nucleuscms.org/documentation/dev ... ugins.html
This is really what I wanted to do originally, but I didn't know enough about the internals of PHP to do it correctly. Now that the content is organized in this fashion and I have all the quirks worked out, it's actually very easy to do.
There is actually a lot of good things in their API, however, some things (like the event system) are a little too much for what we probably want to accomplish.
Akrabat and I originally talked about this in IRC and we have most of the ideas worked out. A class called CMSModule that a module will extend and then override the functions that it wants to use. We talked about the idea of having diffrerent classes for different things, but I think that may complicate matters.
We also need to have some kind of way to doing intermodule communication like we have in 0.8. I'm not sure if that would be part of the class as well, or if there would be some kind of global ModuleFunctions class that would handle this...
Anyway, if anyone has ideas on the matter, please bring them up here or on IRC. I'd like to start this this week, though it will probably be in a separate branch in svn, since it's going to break A LOT of stuff.
Maybe 0.9 should be able to handle both types of modules? I'll have to look into that and see if it would make it harder or easier. Right now, we only have a few modules, so it probably wouldn't be a huge deal to just make 0.9 require the new type. I guess we can handle that when we get to it.
Thanks for your input!
This is really what I wanted to do originally, but I didn't know enough about the internals of PHP to do it correctly. Now that the content is organized in this fashion and I have all the quirks worked out, it's actually very easy to do.
There is actually a lot of good things in their API, however, some things (like the event system) are a little too much for what we probably want to accomplish.
Akrabat and I originally talked about this in IRC and we have most of the ideas worked out. A class called CMSModule that a module will extend and then override the functions that it wants to use. We talked about the idea of having diffrerent classes for different things, but I think that may complicate matters.
We also need to have some kind of way to doing intermodule communication like we have in 0.8. I'm not sure if that would be part of the class as well, or if there would be some kind of global ModuleFunctions class that would handle this...
Anyway, if anyone has ideas on the matter, please bring them up here or on IRC. I'd like to start this this week, though it will probably be in a separate branch in svn, since it's going to break A LOT of stuff.
Maybe 0.9 should be able to handle both types of modules? I'll have to look into that and see if it would make it harder or easier. Right now, we only have a few modules, so it probably wouldn't be a huge deal to just make 0.9 require the new type. I guess we can handle that when we get to it.
Thanks for your input!