CMS  Version 3.9
ModuleManager Class Reference

Public Member Functions

 ModuleManager ()
 

Static Public Member Functions

static upgradeComponent ($version)
 
static registerSerializationHandler ()
 
static addCodeModule ($title, $php_code_file, $component=null, $global=false, $global_position="", $css_class="")
 This utility method adds a code module record for the specified PHP code file. More...
 

Detailed Description

Definition at line 8 of file module_manager.inc.

Member Function Documentation

◆ addCodeModule()

static ModuleManager::addCodeModule (   $title,
  $php_code_file,
  $component = null,
  $global = false,
  $global_position = "",
  $css_class = "" 
)
static

This utility method adds a code module record for the specified PHP code file.

This can be used within upgrade scripts to programmatically deploy modules.

Parameters
string$titlehuman-readable name for the module
string$php_code_filefile path to the module code, relative either to the home directory or to a component directory if a component is specified
string$component(optional) name of the component containing the module code
boolean$global(optional) true if the module is global in scope
string$global_position(optional) position to display at for global modules. This is required if $global is true.
string$css_class(optional) CSS class to be applied to the module when renderered
Returns
Module

Definition at line 39 of file module_manager.inc.

40  {
41  $file = ($component) ? "{$component},{$php_code_file}" : $php_code_file;
42 
43  $module = new Module();
44  $module->title = $title;
45  $module->content_type = "Code";
46  $module->php_code_file = $file;
47  $module->global = $global;
48  $module->global_position = $global_position;
49  $module->css_class = $css_class;
50  $module->save();
51  return $module;
52  }
$component
Definition: help.inc:38
$file
Definition: delete.inc:47
Defines the Module class.
Definition: module.inc:57

◆ ModuleManager()

ModuleManager::ModuleManager ( )

Definition at line 10 of file module_manager.inc.

11  {
12 
13  }

◆ registerSerializationHandler()

static ModuleManager::registerSerializationHandler ( )
static

Definition at line 21 of file module_manager.inc.

22  {
24  return true;
25  }
registerHandler($component, $title, $handler)
Registers a serialization handler for a component.
Provides a simple implementation of a SerializationHandler that can serialize a single DataItem class...

◆ upgradeComponent()

static ModuleManager::upgradeComponent (   $version)
static

Definition at line 15 of file module_manager.inc.

16  {
17  $mgr = new ModuleUpgradeManager();
18  $mgr->upgrade($version);
19  }

The documentation for this class was generated from the following file: