Make optional filename syntax optional and discuss empty widget form element case.

Created on 12 January 2024, about 1 year ago
Updated 22 January 2024, about 1 year ago

Problem/Motivation

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!

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

📌 Task
Status

Active

Component

Code

Created by

🇩🇪Germany Grevil

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024