$parent is a optional value to indicate them inheritance.
If $parent is null / not set, we simply fall back to
the standard behavior, by using 'default'.
$priority is an integer. Modules are sorted by priority and name.
Lowest priority comes first. This property is currently ignored when dealing
with themes.
@param name string Module name
@param desc string Module description
@param author string Module author name
@param version string Module version
@param properties array extra properties (currently available keys : parent, priority, standalone_config)
*/
public function registerModule($name,$desc,$author,$version,$properties = array())
{
if (!is_array($properties)) {
//Fallback to legacy registerModule parameters
$args = func_get_args();
$properties = array();
if (isset($args[4])) {
$properties['parent']=$args[4];
}
if (isset($args[5])) {
$properties['priority']= (integer)$args[5];
}
}
$properties = array_merge(
array(
'parent' => null,
'priority' => 1000,
'standalone_config' => false
), $properties
);
if ($this->id) {
$this->modules[$this->id] = array_merge(
$properties,
array(
'root' => $this->mroot,
'name' => $name,
'desc' => $desc,
'author' => $author,
'version' => $version,
'root_writable' => is_writable($this->mroot)
)
);
}
}
/**
Loads namespace $ns specific file for module with ID
$id
Note : actually, only 'public' namespace is supported with themes.
@param id string Module ID
@param ns string Namespace name
*/
public function loadNsFile($id,$ns=null)
{
switch ($ns) {
case 'public':
$parent = $this->modules[$id]['parent'];
if ($parent) {
// This is not a real cascade - since we don't call loadNsFile -,
// thus limiting inclusion process.
// TODO : See if we have to change this.
$this->loadModuleFile($this->modules[$parent]['root'].'/_public.php');
}
$this->loadModuleFile($this->modules[$id]['root'].'/_public.php');
break;
}
}
}
?>