As started in the Filefield Target issue queue by mistake #2819217: Add Download File with Target field formatter, is it possible to add a target option to the Download Link formatter. This will allow the file to be opened in a new tab or new window if supported by the browser.

Comments

waverate created an issue. See original summary.

waverate’s picture

silvi.addweb’s picture

Status: Active » Needs review
StatusFileSize
new4.09 KB
new12.24 KB
new26.7 KB

Attached patch solves this issue.

waverate’s picture

Tejal,

It looks like your patch is being applied correctly. However, there is a subtle difference that I cannot see. In Display 1, the file is opened in a new tab in the browser. In Display 2, the dialog box with the Open and Save options are displayed. Ideally, I would like to have Display 2 opening up in a new tab in the browser.

Display 1. Filefield Target module using formatter: Generic File with Target

<span class="file">
  <img class="file-icon" alt="" title="application/pdf" src="/modules/file/icons/application-pdf.png">
  <a href="http://example.com/sites/default/files/brochure/brochure-woodhaven-phase-1a-subdivision.pdf" type="application/pdf; length=460191" target="_blank">brochure-woodhaven-phase-1a-subdivision.pdf</a>
</span>

Display 2. File Entity with patch #3 using formatter: Download Link

<span class="file">
  <img class="file-icon" alt="" title="application/pdf" src="/modules/file/icons/application-pdf.png">
  <a href="/file/2515/download?token=QWm7wWdF" type="application/pdf; length=460191" target="_blank">Subdivision Brochure</a>
  <span class="file-size">(449.41 KB)</span>
</span>
silvi.addweb’s picture

Can you please confirm that you want the download link to open new tab and also show open and save dialog?

waverate’s picture

Re: #5

I would like the display formatter to open a new tab.