31,026
edits
mNo edit summary Tag: 2017 source edit |
mNo edit summary Tag: 2017 source edit |
||
| Line 147: | Line 147: | ||
*Check your module descriptor file contains an entry to declare this module has a substitutions file | *Check your module descriptor file contains an entry to declare this module has a substitutions file | ||
< | <syntaxHighlight lang="php"> | ||
$this->module_parts = array('substitutions' => 1) | $this->module_parts = array('substitutions' => 1) | ||
</ | </syntaxHighlight> | ||
*Enable your module (module must be enabled and disabled each time you change the descriptor). | *Enable your module (module must be enabled and disabled each time you change the descriptor). | ||
| Line 164: | Line 164: | ||
*Here are the twists: in the file, write another function with almost the same name but with '_lines' appended, and also add a new $lines variable: | *Here are the twists: in the file, write another function with almost the same name but with '_lines' appended, and also add a new $lines variable: | ||
< | <syntaxHighlight lang="php"> | ||
/** Function called to complete substitution array for lines (before generating on ODT, or a personalized email) | /** Function called to complete substitution array for lines (before generating on ODT, or a personalized email) | ||
* functions xxx_completesubstitutionarray_lines are called by make_substitutions() if file | * functions xxx_completesubstitutionarray_lines are called by make_substitutions() if file | ||
| Line 182: | Line 182: | ||
$substitutionarray['myowntag']=$myvalue; | $substitutionarray['myowntag']=$myvalue; | ||
} | } | ||
</ | </syntaxHighlight> | ||
Contrary to the previous function which was called only once, this function will be called everytime a line of product will be processed, giving you each time a new $line object that you can process. This allows you to do different substitutions for each product. | Contrary to the previous function which was called only once, this function will be called everytime a line of product will be processed, giving you each time a new $line object that you can process. This allows you to do different substitutions for each product. | ||