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.
On a view (content) I try to output my video field (file) as a link to the content. When I activate 'Output this field as a link' I always get a link to the file (/media/fid), no matter what path I enter.
This happens only with the Styles (Module) formatters 'rendered file' and all the 'file styles'.
With the formatter 'filetype icon' the link output is correct.
Any idea where to troubleshoot? Style issue?
Comments
Comment #1
peteruithoven CreditAttribution: peteruithoven commentedYou can link rendered files by rewriting it's output and making it link to the path of the node.
Add "Path" to the fields, exclude it from display and select Use absolute link (under rewrite results).
Edit the file field, under rewrite results you will find a output this field as a link option, select it. Fill in the "[path]" replacement pattern.
I find it weird that this is so hidden, because for me, it's a very common use case.
Comment #2
rnyberg CreditAttribution: rnyberg commentedAs of the latest version. Rewriting no longer links the rendered file. Even making a full rewrite of the field, the file div stays outside the anchor element.
Comment #3
Webbehhttp://drupal.org/node/1858036#comment-6837882
This solves the issue. This is an issue with File Entity, not with Views.
Comment #4
mjk3r CreditAttribution: mjk3r commentedHad the same problem
In Views 7.x-3.5.....
- Media module installed
- have content type "Video"
- it has a field "Video" which takes URL from youtube or vimeo
----
#1 (using absolute path) didn't work for me.
However I got it done by:
1. add field "Nid"
- link it to original piece of content
- exclude from display
2. Rewrite Video field output as follows:
- Output this field as a link
- Link path: node/[nid]
hope it helps even 1 person
with all the best
Comment #5
Chris Matthews CreditAttribution: Chris Matthews as a volunteer commented