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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

idiaz.roncero created an issue. See original summary.

Daniel.Moberly’s picture

Status: Active » Needs review
FileSize
1.73 KB

Tested and verified. Attaching a patch which prevents display of any kind when the download links option is turned off.

CGLDevel’s picture

Just 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.

Daniel.Moberly’s picture

@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.

CGLDevel’s picture

@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

idiaz.roncero’s picture

Many thanks!

  • Daniel.Moberly committed 1ac40e1 on 8.x-1.x
    Issue #2937689 by Daniel.Moberly, idiaz.roncero: Download links label...
Daniel.Moberly’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.