Carrington Build Documentation

Modules Directory Structure

Carrington Build is designed to load groups of modules out of folders. Individual modules aren’t registered by hand, they’re registered when Build loads in the module files. Consider the included modules directory in Carrington Build:

-modules/
    - callout/
        - callout.php
        - icon.png
        - view.php
    - post-callout/
        - css/
            - module-css.inc
            - icon.png
        - img/
            - button-sprite.png
            - etc...
        - js/
            - module-admin-js.inc
            - post-callout.php
            - view.php

 

The Callout module is representative of a typical module. There is a folder named to correspond to the filename that needs to be loaded from that folder, much like a plugin file. Also provided with the module is an icon file as well as a view.php file. The icon file can be named anything appropriate as its path is defined in the plugins constructor function. The view.php should be named view.php to be automatically picked up by Carrington Build.

The Post Callout module is an example of how complex a module can be by providing some of its own javascript, images and css.

Defining Module Load Directories

Carrington Build loads modules by scanning directories for compatible file structures much like WordPress loads Plugins by scanning the Plugins directory. To define a module load directory add a function that runs on the `cfct-module-dirs` filter. For example, to add a modules directory in your theme directory use the code:

function my_register_module_dir($dirs) {
	array_push($dirs, trailingslashit(get_stylesheet_directory()).'modules');
	return $dirs;
}
add_filter('cfct-module-dirs', 'my_register_module_dir', 11);

 

If your module extends a built in module be sure that you add your directory to the end of the array so that it loads after the built in modules. Modules are currently supported loading from themes and child themes.

See also:

Back to Carrington Build

These sections are available to the public. The remaining sections are available exclusively to customers.