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

NameType
inittrigger
renderStarttrigger
renderEndtrigger
renderTemplatecollect
cronUpdatetrigger

Router

NameType
routeHeadertrigger
routeContenttrigger

Breadcrumb

NameType
breadcrumbStarttrigger
breadcrumbEndtrigger

Content

NameType
contentStarttrigger
contentEndtrigger
contentFragmentStarttrigger
contentFragmentEndtrigger
bylineStarttrigger
bylineEndtrigger
paginationStarttrigger
paginationEndtrigger

Comment

NameType
commentStarttrigger
commentEndtrigger
commentFragmentStarttrigger
commentFragmentEndtrigger

Extra

NameType
extraStarttrigger
extraEndtrigger
extraFragmentStarttrigger
extraFragmentEndtrigger

Form

NameType
commentFormStarttrigger
commentFormEndtrigger
consoleFormStarttrigger
consoleFormEndtrigger
installFormStarttrigger
installFormEndtrigger
loginFormStarttrigger
loginFormEndtrigger
recoverFormStarttrigger
recoverFormEndtrigger
registerFormStarttrigger
registerFormEndtrigger
resetFormStarttrigger
resetFormEndtrigger
searchFormStarttrigger
searchFormEndtrigger

Navigation

NameType
navigationCategoryStarttrigger
navigationCategoryEndtrigger
navigationArticleStarttrigger
navigationArticleEndtrigger
navigationCommentStarttrigger
navigationCommentEndtrigger
navigationLanguageStarttrigger
navigationLanguageEndtrigger
navigationTemplateStarttrigger
navigationTemplateEndtrigger

Admin Router

NameType
adminRouteHeadertrigger
adminRouteContenttrigger

Admin Dock

NameType
adminDockStarttrigger
adminDockEndtrigger

Admin Panel

NameType
adminPanelStarttrigger
adminPanelEndtrigger
adminPanelModulecollect
adminPanelNotificationcollect

Admin Form

NameType
adminArticleFormStarttrigger
adminArticleFormEndtrigger
adminCategoryFormStarttrigger
adminCategoryFormEndtrigger
adminCommentFormStarttrigger
adminCommentFormEndtrigger
adminExtraFormStarttrigger
adminExtraFormEndtrigger
adminGroupFormStarttrigger
adminGroupFormEndtrigger
adminModuleFormStarttrigger
adminModuleFormEndtrigger
adminSettingFormStarttrigger
adminSettingFormEndtrigger
adminUserFormStarttrigger
adminUserFormEndtrigger

Admin List

NameType
adminArticleListStarttrigger
adminArticleListEndtrigger
adminCategoryListStarttrigger
adminCategoryListEndtrigger
adminCommentListStarttrigger
adminCommentListEndtrigger
adminExtraListStarttrigger
adminExtraListEndtrigger
adminGroupListStarttrigger
adminGroupListEndtrigger
adminModuleListStarttrigger
adminModuleListEndtrigger
adminUserListStarttrigger
adminUserListEndtrigger
Edit on GitHub