getgrav / grav-plugin-email

Grav Email Plugin
http://getgrav.org
MIT License
37 stars 29 forks source link

Pass page variable to processed forms #141

Closed NicoHood closed 3 years ago

NicoHood commented 3 years ago

Related: https://github.com/getgrav/grav-plugin-form/issues/127

NicoHood commented 3 years ago

I also noticed that site.title and base_url_absolute are also not available in those email templates. I am still not sure why this happens, can you help?

The reason is: I want to list the form attachments in the email sent via data.html.twig:

{% elseif field.type == 'file' %}
    {% set files = form.value(scope ~ field.name) %}
    <ul>
        {% for file in files %}
            <li><a href="{{ base_url_absolute }}/{{ file.path }}">{{ file.name }} ({{ file.size}} Bytes)</a></li>
        {% endfor %}
    </ul>
mahagr commented 3 years ago

Try grav.config.site.title and grav.base_url_absolute.

NicoHood commented 3 years ago

Thanks a lot for the tip! It solved one of my issues!

Can you please have a look at the PR again? It is still relevant though as mentioned here: https://github.com/getgrav/grav-plugin-form/issues/127