- Issue created by @Grevil
- 🇩🇪Germany Grevil
Update from ✨ Adding custom attribute controlled through multiple form elements Active :
>I'm guessing you'll need a custom render element plugin with a value callback
Seems like a good approach to me!
https://www.w3schools.com/tags/att_a_download.asp
The optional value of the download attribute will be the new name of the file after it is downloaded. There are no restrictions on allowed values, and the browser will automatically detect the correct file extension and add it to the file (.img, .pdf, .txt, .html, etc.).
If the value is omitted, the original filename is used.
We currently need to manually provide the file name for the file to download. As we currently HAVE to use the optional filename syntax:
<a download="filename">
Being able to not have to use this optional syntax, like so: <a download>
would be really nice, as it uses the original file name from the href link. BUT, "link_attributes", cleans any empty attributes on line 135 in "LinkWithAttributesWidgetTrait". So not providing any filename in the field widget textfield simply results in the download attribute being removed entirely.
BUT, leaving the filename textfield empty to allow the download attribute to be present on the link without a value (e.g. <a download>
) wouldn't be valid anyway, as we couldn't disable the download link this way. It would always appear. Meaning the best scenario would be to be able to define multiple render form elements for one link attribute.
A checkbox in conjunction with a text field would be an excellent choice!
Active
Code
Update from ✨ Adding custom attribute controlled through multiple form elements Active :
>I'm guessing you'll need a custom render element plugin with a value callback
Seems like a good approach to me!