Module CustomFields Dev: Difference between revisions

Jump to navigation Jump to search
no edit summary
m (change one word, more appropriate in english)
No edit summary
Line 149: Line 149:
An example case of implementation of hooks into a Dolibarr core file can be found in the [[Module_CustomFields_Cases|CustomFields Example Cases wiki page]].
An example case of implementation of hooks into a Dolibarr core file can be found in the [[Module_CustomFields_Cases|CustomFields Example Cases wiki page]].


==== Datasheet hook ====
==== '''Datasheet hook''' ====


To implement CustomFields in your module, you must initialize the hook manager, then use the following hook context:
To implement CustomFields in your module, you must initialize the hook manager, then use the following hook context:
* '''formObjectOptions'''
* formObjectOptions


This hook must be placed everywhere in your code where you want custom fields to appear (eg: on the creation page and datasheet view page).
This hook must be placed everywhere in your code where you want custom fields to appear (eg: on the creation page and datasheet view page).
Line 183: Line 183:
Note2: If after implementing the hook you receive an error or custom fields don't appear, you may have to change $object to another variable, depending on what is called the main object (eg: in Agenda it's called $action and $actioncomm).
Note2: If after implementing the hook you receive an error or custom fields don't appear, you may have to change $object to another variable, depending on what is called the main object (eg: in Agenda it's called $action and $actioncomm).


==== Lines hook ====
==== '''Lines hook''' ====


For product lines, you should anyway use the product lines template files: htdocs/core/tpl/freeproductline_edit.tpl.php
For product lines, you should anyway use the product lines template files: htdocs/core/tpl/freeproductline_edit.tpl.php
Line 239: Line 239:
You need to get the parameters of this module, and you will then put them in the CustomFields configuration file (conf_customfields.lib.php).
You need to get the parameters of this module, and you will then put them in the CustomFields configuration file (conf_customfields.lib.php).


==== Getting the parameters automatically ====
==== '''Getting the parameters automatically''' ====


You can use the [[Module_CustomFields_Dev#Preliminary_test|preliminary test]] to easily get all those parameters.
You can use the [[Module_CustomFields_Dev#Preliminary_test|preliminary test]] to easily get all those parameters.


==== Getting the parameters manually ====
==== '''Getting the parameters manually''' ====


To configure CustomFields to support a module, you need at least 5 parameters:
To configure CustomFields to support a module, you need at least 5 parameters:
439

edits

Navigation menu