Module Basics

Modules are located inside the modules directory and can be installed and edited under admin/view/modules.

Hidden feature

The documentation can be found while editing a module, each PHTML file inside the docs directory represents a tab.

Edit on GitHub

Module Structure

Head

Namespace statement and docblock of the ModuleName class:

<?php
namespace Redaxscript\Modules\ModuleName;

/**
 * long module description
 *
 * @since 3.0.0
 *
 * @package Redaxscript
 * @category Modules
 * @author Author Name
 */

Body

Empty ModuleName skeleton with a basic configuration:

class ModuleName extends Module\Module
{
	/**
	 * array of the module
	 *
	 * @var array
	 */

	protected static $_moduleArray =
	[
		'name' => 'Module Name',
		'alias' => 'ModuleName',
		'author' => 'Author Name',
		'description' => 'Long module description',
		'version' => '3.0.0',
		'status' => 1,
		'access' => null
	];
}

Init

Optional method to override the default init process:

/**
 * init
 *
 * @since 3.0.0
 */

public function init()
{
}

Hook

Optional method to trigger one of the module hooks:

/**
 * ModuleHook
 *
 * @since 3.0.0
 */

public function ModuleHook()
{
}

Render

Optional method to be called inside the <module> content tag:

/**
 * render
 *
 * @since 3.0.0
 */

public function render()
{
}

Install

Optional method to override the default install process:

/**
 * install
 *
 * @since 3.0.0
 */

public function install()
{
}

Uninstall

Optional method to override the default uninstall process:

/**
 * uninstall
 *
 * @since 3.0.0
 */

public function uninstall()
{
}
Edit on GitHub

Module Configuration

Config

Example of a Config class that stores the ModuleName configuration.

<?php
namespace Redaxscript\Modules\ModuleName;

use Redaxscript\Module;

/**
 * children class to store module configuration
 *
 * @since 3.0.0
 *
 * @package Redaxscript
 * @category Modules
 * @author Author Name
 */

class Config extends Module\Module
{
	/**
	 * array of config
	 *
	 * @var array
	 */

	protected $_configArray =
	[
	];
}

Module

Example of a ModuleName class that extends from the Config class.

<?php
namespace Redaxscript\Modules\ModuleName;

/**
 * long module description
 *
 * @since 3.0.0
 *
 * @package Redaxscript
 * @category Modules
 * @author Author Name
 */

class ModuleName extends Config
{
	/**
	 * array of the module
	 *
	 * @var array
	 */

	protected static $_moduleArray =
	[
		'name' => 'Module Name',
		'alias' => 'ModuleName',
		'author' => 'Author Name',
		'description' => 'Long module description',
		'version' => '3.0.0',
		'status' => 1,
		'access' => null
	];
}
Edit on GitHub

Module Hooks

General

Name Type
init trigger
renderStart trigger
renderEnd trigger
renderTemplate collect

Router

Name Type
routerStart trigger
routerEnd trigger

Breadcrumb

Name Type
breadcrumbStart trigger
breadcrumbEnd trigger

Content

Name Type
contentStart trigger
contentEnd trigger
contentFragmentStart trigger
contentFragmentEnd trigger
bylineStart trigger
bylineEnd trigger
paginationStart trigger
paginationEnd trigger

Comment

Name Type
commentStart trigger
commentEnd trigger
commentFragmentStart trigger
commentFragmentEnd trigger

Extra

Name Type
extraStart trigger
extraEnd trigger
extraFragmentStart trigger
extraFragmentEnd trigger

Navigation

Name Type
navigationStart trigger
navigationEnd trigger

Form

Name Type
formStart trigger
formEnd trigger

Admin

Name Type
adminDockStart trigger
adminDockEnd trigger
adminPanelStart trigger
adminPanelEnd trigger
adminPanelModule collect
adminPanelNotification collect
Edit on GitHub