Developer's documentation
  • The modular approach to this CMS looks to be very powerful. I was wondering if and when a developer's documentation guide would be posted.

    I'm particular interested in how to develop new modules and how the hooks, exceptions, details.xml, and install.xml all tie in together. If someone can explain these, it'd be greatly appreciated.
  • Hi there,

    Saw your question in the IRC channel before but was not around to help! We shall be working on documentation after the release of 2.4 which is in a few weeks - as of yet there is zero. However, feel free to ask for anything specific in the IRC channel (I'm in GMT timzone and mostly on 16:00 onwards).

    The only thing I can suggest right now is to read the code of existing modules (make sure you read the 2.4.x code, not 2.3.x since it has been heavily cleaned up) to get an idea of how things work. The developers at where I work have just started to learn the framework that powers TangoCMS, and seem to be picking it up quite fast with little/no help from me. I don't quite have time to explain everything here right now, but a basic overview of some things you mentioned:

    details.xml: This basically provides information that is displayed to the user about the module (mostly in the Module Manager module). For example, you have the Name and Title (name is a 'clean version' of the Title) and description.

    install.xml: Provides data needed to check the environment that the module is about to be installed in, and to setup initial configuration. For example, the 'dependencies' element can make the framework check PHP version, Project verison or Zula (the framework) version. If it doesn't meet the module requirements, it wont/can't be installed. You'll then see ACL Resources, this adds all new needed ACL resources for this module to work, for example you'd have a foobar_edit, foobar_add, foobar_delete resources which can control which groups (roles) have permission to do certain things.

    install.sql: Queries to be executed when we know the module can be installed.

    Exceptions.php is just your normal PHP classes extending the built-in 'Exception' class in PHP to provide flexible error handling within the module you're coding.

    Hooks can be quite a complex subject, but in short: An event is triggered, and a hook can respond to it whilst optionally providing data back to the event. They can be used to alter the flow of the framework, without having to edit the framework code. An example of this is the Aliases module, it hooks into the 'router_pre_parse' and 'router_make_url' events to change the URL before it gets parsed by the Router libraries, and after it gets built, respectively.

    We shall 100% get documentation up though, and as said - please feel free to either email me (alex @ obvious-domain-name.org) or join the IRC channel to ask any questions =)
  • Thanks for the response Alex.

    Can you point me to what files in the Zula Framework manage modules (ex: Which ones read/analyze the install.xml and details.xml files) and which ones manage events/hooks. Thanks

    I look forward to seeing both TangoCMS and Zula Framework documentation.

    Cheers.
  • Those would be ./application/libraries/Module.php and ./application/libraries/Hooks.php. The Module library is one of the biggest, but the methods you'll need are getInstallDetails l448, install l367, getDetails l279.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion