Implemented file tokens for bulky items #375
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This implements a general listener for all bulky items.
For example, if you have a
##form_upload##
field with an associated bulky items voucher, you will now automatically also get a##file_item_html_form_upload##
and##file_item_text_form_upload##
token.You notice, the format is:
file_item_<format>_<tokenName>
.The contents of those are defined by the new
@Contao/notification_center/file_token.html.twig
template which you can adjust. By default it will generate the following outputs:For
text
:For
html
:You may adjust the
@Contao/notification_center/file_token.html.twig
according to your needs. You get the file items, the format but also the entireParcel
as template context in case you need to do anything complex.The Twig template uses a
notification_center_file_url()
method that generates the URL to the file. It takes an optional 2nd parameter for$ttl
in case you want to limit the downloads to a certain expiry date which I don't think is a requirement by default.