could it be that not every variable has content when one is trying to create a template?
What I mean, is: I’m trying to create a template. It seems that I cannot check my code for failures, because some variables I use to not produce any output in the pdf-preview. So I think, how is one supposed to know if one’s code is correct when there’s no right or false reaction to it?
For example: when I use the code (…) <ninja> {% if invoices %} {% set invoice = invoices|first %} (…) {{ invoice.client_id }} (…)
there’s no output at all for {{ invoice.client_id }}. But $client_id at least echoes “The Client Name_Id”.
Otherwise there’s at least a pop-up when the backend cannot create the pdf. But it’s only a hint without any advice what I did wrong.
At least it would be great, if the test-invoice or -data we’re dealing with within the design-editor would have all possible variables be filled or at least one can see what’s filled and what’s not.
In the docs we show every field / definition that is currently available:
These variables are ones that can be used within the twig component itself.
Standard $variables are also available if needed so can be used in parallel.
One this to note is that $ variables cannot be used in any logic so you cannot combine twig and $ variable like this
{% if $invoice.client_id_number == 'xx' %}
This is because the $variables are render AFTER the twig component however you can use them like this:
{%if invoice.number == 'xxx' %}
$client.number is a great client.
{%endif%}
We are working on a twig linter so you’ll be able to get feedback on failures, i have the linter working via api, we want to also include this in the monaco editor so that linting can be done there also.
Thanks a lot. Those facts I already figured out, but I appreciate it that you clarify this here!
Well, it seems that there are some twig variables are missing to build the “perfect” invoice design. Or it’s possible if one’s a twig-professional, you know.
However I will follow your great works and I hope that someday I can help you maybe with the project. I already found some weird translations which could be improved to help the user understanding the GUI better.