0

I have added a file-field to my Page content type and activated the description field. Multiple files are allowed.

I want to create a block (with Views) that displays the list of files (descriptions with links) attached to a given page.

I have tried 2 approaches:

  1. In views I have added a relationship with files, but the description is not accessible from the list of fields provided (filename, size, extension, but no description)

  2. Create a new display (in addition to default and Teaser ) with the Content:Files field, it displays the list nicely BUT it shows the title and I can't see any option to disable it.

If someone has an idea that would be great! Thanks a lot.

2
  • What version of Drupal are you using?
    – Teegan
    Commented May 16, 2012 at 2:53
  • @ Teegan : I am using Drupa 7 and Views 3
    – znat
    Commented May 16, 2012 at 10:02

1 Answer 1

2

If this is for Drupal 7, a solution I found was using Rewrite Results. Create a view showing Content of type Page which displays an unformatted list of fields. Within the View, under fields add your File Field. In the settings for the field set the Formatter to URL to file, remove the label and then under Rewrite Results tick "Rewrite the output of this field". Within this section you have access to the files description field so you can enter something like

<a href="[field_files]">[field_files-description]</a>

Which will output the description as a link to your file.

2
  • [field_file] displays the whole file information (icon, description and link). I could not find a field displaying the url
    – znat
    Commented May 17, 2012 at 2:41
  • I thought that too but I think thats why you have to make sure you set the format of the field (drop down at top of field form) to be URL to File so that it will output a link.
    – Teegan
    Commented May 17, 2012 at 2:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.