Module CustomFields Dev: Difference between revisions

Jump to navigation Jump to search
→‎Lines hooks: Fixed the explanation
(→‎Lines hooks: Fixed the explanation)
Line 895: Line 895:


<source lang="php">
<source lang="php">
$parameters=array('line'=>$line,'fk_parent_line'=>$line->fk_parent_line);
$parameters=array('line'=>$line);


echo $hookmanager->executeHooks('formEditProductOptions',$parameters,$this,$action);
echo $hookmanager->executeHooks('formEditProductOptions',$parameters,$object,$action);
</source>
</source>


Hooks names:
The two important things here are that you supply:
* formEditProductOptions
* $line: the line object, with a $line->rowid property.
* formCreateProductOptions ($line is not required here, because we create a new product line! you can leave $parameters=array(); empty).
* $object: the parent object of the line, with a $object->rowid property. For example, if $line is an invoice line, then $object must be the parent invoice object. This is necessary so that CustomFields can automatically recognize the link between the twos.
 
Possible hooks names:
* formEditProductOptions: called when you edit a line.
* formCreateProductOptions: called when you create a line. $line is not required here, because we create a new product line! you can leave $parameters=array(); empty.
Note: there's no hook for viewing, because showing the customfields will clutter the visual field, but if you really want you can also do it by adding a formViewProductOptions hook.
Note: there's no hook for viewing, because showing the customfields will clutter the visual field, but if you really want you can also do it by adding a formViewProductOptions hook.


439

edits

Navigation menu