Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hello;
On Audiofield 8.x-1.x-dev and Drupal 8.4.4 and using Wavesurfer.js
I realized that even when marking Display download button= No and Display download link = No on the field widget, the label "Download files" gets printed.
A quick solution is to check for {% files %} on audiofield-download-links.html.twig before printing anythng:
{% if links %}
<table class="audiofield-downloads">
<caption>{{ 'Download files:'|trans }}</caption>
{% for file in links %}
<tr>
<td class="audiofield-download-link">{{ file.link }}</td>
</tr>
{% endfor %}
</table>
{% endif %}
Instead of
<table class="audiofield-downloads">
<caption>{{ 'Download files:'|trans }}</caption>
{% for file in links %}
<tr>
<td class="audiofield-download-link">{{ file.link }}</td>
</tr>
{% endfor %}
</table>
This is a quick fix but I think it would be even better not to print the twig template at all.
Comment | File | Size | Author |
---|---|---|---|
#2 | download_links_title_incorrect_display-2937689-2.patch | 1.73 KB | Daniel.Moberly |
Comments
Comment #2
Daniel.Moberly CreditAttribution: Daniel.Moberly commentedTested and verified. Attaching a patch which prevents display of any kind when the download links option is turned off.
Comment #3
CGLDevel CreditAttribution: CGLDevel commentedJust curious, any chance for something like this for Drupal 7? I'm trying to remove the download option from the audiofield... Even with permission settings ticked to only allow admin to download file...anonymous users can still view / download the file.
Comment #4
Daniel.Moberly CreditAttribution: Daniel.Moberly commented@CGLDevel I primarily maintain the D8 version of the project (since I wrote it) and am not super familiar with the D7 version; its not something I can just backport since the D8 version is a complete rewrite. I would open a new issue in the queue and tag it for the 7.x version since it would be an entirely separate issue.
Comment #5
CGLDevel CreditAttribution: CGLDevel commented@Daniel.Moberly - No problem, I just saw this thread when I was researching potential solutions and thought I would inquire. I've submitted an issue to the 7.x folks; thanks for your insight!
Here's the link incase any other 7.x users stumble across this like I did and want to follow along: https://www.drupal.org/project/audiofield/issues/2937806
Comment #6
idiaz.ronceroMany thanks!
Comment #8
Daniel.Moberly CreditAttribution: Daniel.Moberly commented