Carrington Build Documentation

The Module File

The main module file is where the module should be defined and registered with Carrington Build. The minimum requirements for a module to work are the `__construct` method, the `admin_form` method, the `display` method, and the `text` method. While other methods can be defined and used to create complex modules they’re not required to create a valid module.

class my_build_module_class extends cfct_build_module {
	public function __construct() {
		$opts = array(
			'description' => _('...'),
			'icon' => 'path/to/icon.png'
		parent::__construct('my-module-id', __('My Module'), $opts);

	public function admin_form($data) {
		// ... build form
		return $form_html;

	public function display($data) {
		// build HTML display from saved data
		return $this->load_view($data);

	public function text($data) {
		// return short textual represntation of the module's saved data here
		return '...';

Available Methods

Override-able methods

: Override these methods to define your module’s behavior.


__construct(): The constructor is where the module should set itself up. Here the module defines its Title, Descriptions and Icon file.

display(): Use the display method to process data for display and to pass the data on to the `load_view()` method for HTML construction. While the use of `load_view` is not required it is highly recommended to make the module flexible.

admin_form(): Return the HTML of the admin form. Any form elements output here will be submitted and saved when a user saves the module.

Return false or null from this method to not display a form. The Admin will auto-fill a “no options” message for you.


text(): Return a shortened representation of the module’s content for admin use. This should be something short to help identify the content when looking at the wordpress post-edit screen.

update(): Use this method to filter out or modify submitted data from the module save process before the data is saved to the database.

admin_js(): Return relevant Javascript to be included in the admin.

admin_css(): Return relevant CSS for your Module’s admin layout. See the section below on Custom CSS for more information.

js(): Return relevant client side javascript for your module.

css(): Return relevant client side CSS for your module.

list_admin(): Return false to hide the module from the module select dialog.

Utility Methods: Methods provided by the system to help you develop your module.

load_view(): Load the view file for this module. Not required, but recommended to make your module flexible.

get_field_name()/get_field_id(): Returns a name-spaced version of the field name or id to avoid naming conflicts across modules and the Carrington Build admin.

get_url(): Returns the full url path to the module’s folder.

get_path(): Returns the full file system path to the module’s folder.

humanize(): Returns a “human readable” version of keynames and ids. For example ‘post_thumbail_home’ is transformed in to ‘Post Thumbnail Home’.

wp_formatting(): Applies WordPress’ rich text content formatting to a string.

See also:

Back to Carrington Build

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