Skip to content

Instantly share code, notes, and snippets.

@gpickin
Last active May 19, 2016 16:29
Show Gist options
  • Save gpickin/f7b0a53353230d326ef31d1d3d4996ef to your computer and use it in GitHub Desktop.
Save gpickin/f7b0a53353230d326ef31d1d3d4996ef to your computer and use it in GitHub Desktop.
/**
Module Directives as public properties
this.title = "Title of the module";
this.author = "Author of the module";
this.webURL = "Web URL for docs purposes";
this.description = "Module description";
this.version = "Module Version";
this.viewParentLookup = (true) [boolean] (Optional) // If true, checks for views in the parent first, then it the module.If false, then modules first, then parent.
this.layoutParentLookup = (true) [boolean] (Optional) // If true, checks for layouts in the parent first, then it the module.If false, then modules first, then parent.
this.entryPoint = "" (Optional) // If set, this is the default event (ex:forgebox:manager.index) or default route (/forgebox) the framework
will use to create an entry link to the module. Similar to a default event.
this.cfmapping = "The CF mapping to create";
this.modelNamespace = "The namespace to use for registered models, if blank it uses the name of the module."
this.dependencies = "The array of dependencies for this module"
structures to create for configuration
- parentSettings : struct (will append and override parent)
- settings : struct
- datasources : struct (will append and override parent)
- interceptorSettings : struct of the following keys ATM
- customInterceptionPoints : string list of custom interception points
- interceptors : array
- layoutSettings : struct (will allow to define a defaultLayout for the module)
- routes : array Allowed keys are same as the addRoute() method of the SES interceptor.
- wirebox : The wirebox DSL to load and use
Available objects in variable scope
- controller
- appMapping (application mapping)
- moduleMapping (include,cf path)
- modulePath (absolute path)
- log (A pre-configured logBox logger object for this object)
- binder (The wirebox configuration binder)
- wirebox (The wirebox injector)
Required Methods
- configure() : The method ColdBox calls to configure the module.
Optional Methods
- onLoad() : If found, it is fired once the module is fully loaded
- onUnload() : If found, it is fired once the module is unloaded
*/
component {
// Module Properties
this.title = "customModule";
this.author = "Ortus Solutions";
this.webURL = "http://www.ortussolutions.com";
this.description = "custom Module";
this.version = "1.0.0";
// If true, looks for views in the parent first, if not found, then in the module. Else vice-versa
this.viewParentLookup = true;
// If true, looks for layouts in the parent first, if not found, then in module. Else vice-versa
this.layoutParentLookup = true;
// Module Entry Point
this.entryPoint = "customModule";
// Model Namespace
this.modelNamespace = "customModule";
// CF Mapping
this.cfmapping = "customModule";
// Auto-map models
this.autoMapModels = true;
// Module Dependencies
this.dependencies = [];
function configure(){
// parent settings
parentSettings = {
};
// Layout Settings
layoutSettings = {
defaultLayout = ""
};
// datasources
datasources = {
};
// SES Routes
routes = [
// Module Entry Point
{ pattern="/", handler="home", action="index" },
// Convention Route
{ pattern="/:handler/:action?" }
];
// Custom Declared Points
interceptorSettings = {
customInterceptionPoints = ""
};
// Custom Declared Interceptors
interceptors = [];
// Binder Mappings
// binder.map("Alias").to("#moduleMapping#.model.MyService");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment