@@ -63,6 +63,11 @@ Example:
63
63
64
64
$templateProcessor->setImageValue('CompanyLogo', 'path/to/company/logo.png');
65
65
$templateProcessor->setImageValue('UserLogo', array('path' => 'path/to/logo.png', 'width' => 100, 'height' => 100, 'ratio' => false));
66
+ $templateProcessor->setImageValue('FeatureImage', function () {
67
+ // Closure will only be executed if the replacement tag is found in the template
68
+
69
+ return array('path' => SlowFeatureImageGenerator::make(), 'width' => 100, 'height' => 100, 'ratio' => false);
70
+ });
66
71
67
72
cloneBlock
68
73
""""""""""
@@ -127,7 +132,7 @@ Given a template containing
127
132
This block content will be replaced
128
133
${/block_name}
129
134
130
- The following will replace everything between``${block_name}`` and ``${/block_name} `` with the value passed.
135
+ The following will replace everything between ``${block_name} `` and ``${/block_name} `` with the value passed.
131
136
132
137
.. code-block :: php
133
138
@@ -190,7 +195,7 @@ Finds a row in a table row identified by `$search` param and clones it as many t
190
195
['userId' => 1, 'userName' => 'Batman', 'userAddress' => 'Gotham City'],
191
196
['userId' => 2, 'userName' => 'Superman', 'userAddress' => 'Metropolis'],
192
197
];
193
- $templateProcessor->cloneRowAndSetValues('userId', );
198
+ $templateProcessor->cloneRowAndSetValues('userId', $values );
194
199
195
200
Will result in
196
201
@@ -244,3 +249,31 @@ See ``Sample_40_TemplateSetComplexValue.php`` for examples.
244
249
$table->addCell(150)->addText('Cell B2');
245
250
$table->addCell(150)->addText('Cell B3');
246
251
$templateProcessor->setComplexBlock('table', $table);
252
+
253
+ setChartValue
254
+ """""""""""""
255
+ Replace a variable by a chart.
256
+
257
+ .. code-block :: php
258
+
259
+ $categories = array('A', 'B', 'C', 'D', 'E');
260
+ $series1 = array(1, 3, 2, 5, 4);
261
+ $chart = new Chart('doughnut', $categories, $series1);
262
+ $templateProcessor->setChartValue('myChart', $chart);
263
+
264
+ save
265
+ """"
266
+ Saves the loaded template within the current directory. Returns the file path.
267
+
268
+ .. code-block :: php
269
+
270
+ $filepath = $templateProcessor->save();
271
+
272
+ saveAs
273
+ """"""
274
+ Saves a copy of the loaded template in the indicated path.
275
+
276
+ .. code-block :: php
277
+
278
+ $pathToSave = 'path/to/save/file.ext';
279
+ $templateProcessor->saveAs($pathToSave);
0 commit comments