Module CustomFields Dev: Difference between revisions

Jump to navigation Jump to search
→‎customfields_fill_object(): Adding more details to the full specification of the method
(→‎customfields_fill_object(): Adding more details to the full specification of the method)
Line 476: Line 476:
Note: $object can also be a dummy object containing only two properties that are required: $object->id and $object->table_element.
Note: $object can also be a dummy object containing only two properties that are required: $object->id and $object->table_element.


For more informations on pratical usages of this function, please [[Module_CustomFields#Implementing_in_php_code_.28dolibarr_core_modules_or_your_own_module.29|read the user documentation on how to implement CustomFields in php code]].
We will now describe the full specification of this function:
<source lang="php">
$customfields = customfields_fill_object(&$object,$fromobject = null, $outputlangs = null, $prefix = null,$pdfformat = false);
</source>
 
* $object is the object where the customfields will be saved
* $fromobject is the object from where the customfields will be fetched (this can be a different module than $object, or can be null to be the same as $object)
* $outputlangs is the target language for translation of fields value (if empty, the default current global translation object will be used)
* $prefix allows you to save the custom fields in a sub-object. By default, when $prefix=null, custom fields are saved in the path $object->customfields, but when you specify a prefix, custom fields will be saved inside $object->customfields->$prefix. This may be useful if you want to store multiple object's custom fields or records in the same $object.
* $pdfformat defines if you want a special formatting for the values: if null, there's no formatting, if false, there is a simple formatting (eg: translation of fields' values), if true then the formatting will be adapted for PDF templating.
 
For more informations on pratical usages of this function, please [[Module_CustomFields#Implementing_in_php_code_.28dolibarr_core_modules_or_your_own_module.29|read the user documentation on how to implement CustomFields in php code]] or [[http://wiki.dolibarr.org/index.php/Module_CustomFields_Cases#Linking_Dolibarr_objects_from_two_different_modules|read an example case of linking two objects of different modules together]].


== customfields_fill_object_lines() ==
== customfields_fill_object_lines() ==
439

edits

Navigation menu