Merge branch 'Issue_#66' into 'master'
Issue #66. Added the ability to add module aliases. Setting a alias can be done by adding the aliases array to the moduleInfo.php and setting the names in there. An example can be found in the example module. See merge request !36
This commit is contained in:
commit
be41c950f7
|
@ -313,6 +313,14 @@ class Modules extends Bus{
|
|||
// Copy all the data into the register and enable
|
||||
$register[$name] = (array) $cfg;
|
||||
$this->logger->log("[ON] '".$name."'");
|
||||
|
||||
// Add all module aliases if available
|
||||
if (isset($cfg->aliases)) {
|
||||
foreach ($cfg->aliases as $alias) {
|
||||
$register[$alias] = (array) $cfg;
|
||||
$this->logger->log("[ON] '".$alias."' (alias of '".$name."')");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// If not, copy all the basic data so that it can be enabled in the future
|
||||
$cfg2 = new StdClass();
|
||||
|
@ -321,11 +329,27 @@ class Modules extends Bus{
|
|||
$cfg2->meta = $cfg;
|
||||
$register[$name] = (array)$cfg2;
|
||||
$this->logger->log("[OFF] '".$name."'");
|
||||
|
||||
// Add all module aliases if available
|
||||
if (isset($cfg->aliases)) {
|
||||
foreach ($cfg->aliases as $alias) {
|
||||
$register[$alias] = (array) $cfg2;
|
||||
$this->logger->log("[OFF] '".$alias."' (alias of '".$name."')");
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Copy all the data into the register and enable
|
||||
$register[$name] = (array) $cfg;
|
||||
$this->logger->log("[ON] '".$name."'");
|
||||
|
||||
// Add all module aliases if available
|
||||
if (isset($cfg->aliases)) {
|
||||
foreach ($cfg->aliases as $alias) {
|
||||
$register[$alias] = (array) $cfg;
|
||||
$this->logger->log("[ON] '".$alias."' (alias of '".$name."')");
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// If no details are specified, create a basic module
|
||||
|
|
|
@ -49,6 +49,14 @@ class Main extends Module {
|
|||
// Do Something
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method that can be called
|
||||
* @return String Example text
|
||||
*/
|
||||
public function test() {
|
||||
return "It works!";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
|
@ -35,6 +35,7 @@ return array(
|
|||
'module_name' => 'Example',
|
||||
|
||||
'abstract' => false,
|
||||
'aliases' => array('techfuze/example'),
|
||||
'dependencies' => array(),
|
||||
'events' => array(),
|
||||
'sections' => array(),
|
||||
|
@ -48,5 +49,5 @@ return array(
|
|||
'date_created' => '29-04-2015',
|
||||
'date_updated' => '29-04-2015',
|
||||
|
||||
'enabled' => true,
|
||||
'enabled' => true
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue