Create a reusable module
Create apps_user/zotonic_mod_garden with the following files. This example adds a discoverable module without starting an extra process.
Create apps_user/zotonic_mod_garden with the following files. This example adds a discoverable module without starting an extra process.
rebar.config:
{erl_opts, [debug_info]}.
src/zotonic_mod_garden.app.src:
{application, zotonic_mod_garden, [
{description, "Community garden features"},
{vsn, "0.1.0"},
{registered, []},
{applications, [kernel, stdlib, zotonic_core]},
{env, []},
{modules, []}
]}.
src/mod_garden.erl:
-module(mod_garden).
-mod_title("Garden").
-mod_description("Community garden features.").
-mod_prio(500).
Run make from the Zotonic workspace root. On the running development node, use bin/zotonic update to refresh discovery. Open module management in the site's admin and activate Garden.
Check that the module is active. Add the model from Expose data through a model for a first data lookup, and put templates in priv/templates. Keep installation hooks and observers in the main module; move domain logic into models or support modules.