New: possibility to defined hooks in array format with parts module
system
This commit is contained in:
parent
2dabf0e185
commit
e257d7d6d4
@ -68,14 +68,18 @@ class modMyModule extends DolibarrModules
|
||||
// If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module'
|
||||
$this->picto='generic';
|
||||
|
||||
// Defined all module parts (triggers, login, substitutions, menus, css, etc...) (0=disable,1=enable default path, '/mymodule/path/to/parts' for specific path)
|
||||
$this->module_parts = array();
|
||||
// Defined all module parts (triggers, login, substitutions, menus, css, etc...)
|
||||
// for default path (eg: /mymodule/core/triggers) (0=disable, 1=enable)
|
||||
// for specific path of parts (eg: /core/modules/barcode)
|
||||
// for specific css file (eg: /css/mymodule.css.php)
|
||||
//$this->module_parts = array( 'triggers' => 1,
|
||||
// 'login' => 0,
|
||||
// 'substitutions' => '/specific/path/in/your/module',
|
||||
// 'menus' => 0
|
||||
// 'css' => '/css/mymodule.css.php'
|
||||
// 'barcode => /path/to/your/parts');
|
||||
// 'substitutions' => 0,
|
||||
// 'menus' => 0,
|
||||
// 'css' => '/css/mymodule.css.php',
|
||||
// 'barcode' => '/path/to/your/parts',
|
||||
// 'hooks' => array('hookcontext1','hookcontext2'));
|
||||
$this->module_parts = array();
|
||||
|
||||
// Data directories to create when module is enabled.
|
||||
// Example: this->dirs = array("/mymodule/temp");
|
||||
@ -99,7 +103,6 @@ class modMyModule extends DolibarrModules
|
||||
// List of particular constants to add when module is enabled (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive)
|
||||
// Example: $this->const=array(0=>array('MYMODULE_MYNEWCONST1','chaine','myvalue','This is a constant to add',1),
|
||||
// 1=>array('MYMODULE_MYNEWCONST2','chaine','myvalue','This is another constant to add',0)
|
||||
// 2=>array('MAIN_MODULE_MYMODULE_HOOKS','chaine','hookcontext1:hookcontext2','To say: This module manage hooks in hookcontext1 and hookcontext2',1,'current',1)
|
||||
// );
|
||||
$this->const = array();
|
||||
|
||||
|
||||
@ -156,6 +156,7 @@ class Conf
|
||||
$this->tabs_modules[$params[0]][]=$value;
|
||||
}
|
||||
// If this is constant for hook activated by a module. Value is list of hooked tabs separated with ':'
|
||||
// TODO obsolete (see generic parts)
|
||||
elseif (preg_match('/^MAIN_MODULE_([A-Z_]+)_HOOKS$/i',$key,$reg))
|
||||
{
|
||||
$modulename = strtolower($reg[1]);
|
||||
@ -184,7 +185,9 @@ class Conf
|
||||
$modulename = strtolower($reg[1]);
|
||||
$partname = strtolower($reg[2]);
|
||||
$varname = $partname.'_modules';
|
||||
$value = ($value === 1 ? '/'.$modulename.'/core/'.$partname.'/' : '/'.$modulename.'/'.$value);
|
||||
$arrValue = unserialize($value);
|
||||
if (is_array($arrValue) && ! empty($arrValue)) $value = $arrValue;
|
||||
else $value = ($value === 1 ? '/'.$modulename.'/core/'.$partname.'/' : '/'.$modulename.'/'.$value);
|
||||
$this->$varname = array_merge($this->$varname, array($modulename => $value));
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user