DemoBundle
                                
                                 DemoBundle copied to clipboard
                                
                                    DemoBundle copied to clipboard
                            
                            
                            
                        Extending export controler / adding calculated values to pdf.twig export template
I have created a copy of an already existing PDF template and saved it unter var/export/myexport.pdf.twig. I modified it to my needs and this worked pretty well.
Now I want to add custom rounding to the duration field where some math is implied. Since I was not able to achieve this just with twig filters, I would like to add an extra field like duration_rounded and do the calculation of this value in PHP.
What would be the best / update safe way to implement this? Is it possible to register to a hook or extend the controller?
I think using your own plugin with a simple Twig filter should be sufficient.
Thank you.
I was able to do the rounding in my template with a few set var = <calculation> steps in between.
I'm still wondering, if I would like to add a custom twig filter, would this be possible to be done update proof like it is possible with Invoice templates placed under /var/export/ so that they don't get overwritten?
Plugins will never be overwritten during updates. A plugin is more complex to setup though, but thats what this repository is made for.