knewter edited this page Sep 13, 2010 · 7 revisions

We need to execute any code that plugins will need to hook into before the Rails initialize block in config/environment.rb (at the top of the file).

Ansuz::PluginManager will have an attr_accessor :plugins, and each Ansuz plugin will need to register itself.

A plugin will provide modules. Each Frontend module will need an associated Backend module. For instance, a ContentSection will have a base Frontend module that just renders the ContentSection on the page, and an associated Backend module that allows one to modify the content.

A plugin’s registration in init.rb could look something like this:

    # this registers a page_plugin, not a great method name

    # this registers a nav entry in the user-facing ansuz menu.  This will change, to
    # registering a potential 'special' entry in the ansuz menu system.
    Ansuz::PluginManagerInstance.register_plugin_nav('Blog', '/articles') 

    # this registers an entry in the 'Content' menu in the admin, to handle the blog 
    # administration
        'Blog > All Posts', 

    # this adds an entry to create a new post from the admin menu
        'Blog > New Post', 

…where Ansuz::Plugins::JAdams::ContentSection defines its Frontend modules and their related Backend modules.