Hooks system: Difference between revisions

Jump to navigation Jump to search
(Added more infos about the const update)
Line 24: Line 24:
Then you get the value at the third index, which is a string with contexts separated by a comma.
Then you get the value at the third index, which is a string with contexts separated by a comma.


<source lang="php">
'''IMPORTANT''': Be careful: do not forget to DISABLE then RENABLE the module in the admin panel to accept the now const values, because these constants are only added to the database when enabling the module.
[b]IMPORTANT[/b]: Be careful: do not forget to DISABLE then RENABLE the module in the admin panel to accept the now const values, because these constants are only added to the database when enabling the module.


And please note that the const are updated because there is the remove() function (in the same file) that tells Dolibarr to remove the constants when disabling the module, else Dolibarr would not update the constants if they were not removed first (even if the values changed). Your remove() function should be something similar to this:
And please note that the const are updated because there is the remove() function (in the same file) that tells Dolibarr to remove the constants when disabling the module, else Dolibarr would not update the constants if they were not removed first (even if the values changed). Your remove() function should be something similar to this:


[code]
<source lang="php">
/**
/**
* Function called when module is disabled.
* Function called when module is disabled.
Line 42: Line 41:
return $this->_remove($sql);
return $this->_remove($sql);
}
}
[/code]
</source>
</source>


439

edits

Navigation menu