I have a content type I have a cck field "field_release_tracks" (Fieldtype: File / Widget: Media file selector) with multiple values and I want to get / display the single file-fields defined under "admin/config/media/file-types/manage/audio/fields" in a special way:

- Title (media_title)
- Description (media_description)
- File-URL

How can I access the single values with views?
Or could I achieve the wanted output with a "custom formatter" (admin/structure/formatters) ? If yes how?

Thank you very much for every answer!

Comments

deciphered’s picture

Status: Active » Fixed

Hi,

Obviously asking in the issue queue of the Custom Formatters how to do something in the Views module is unlikely to get a response, that sort of thing would be best to ask in the Views module or the Media module.

I can certainly help you with Custom Formatters though.

It should be doable with HTML + Tokens, but unfortunately Field tokens are a bit of a cluster f**k in drupal 7, so I'll demo briefly how to do it with the PHP engine:

1. Make sure the Devel module is installed and enabled
2. Make a new PHP formatter for the 'file' field.
3. In the code field, simply type: return;
4. Open the preview section, chose your field and an entity and hit the preview button
5. In the debug code you will see all the available data, inside of #items is a list off all the file fields on that entity, each containing the data you need.
6. Use the data to write a Formatter.

There's two example formatters provided with the module, and plenty more can be found at CustomFormatters.com that should help you achieve what you need.

I am also working on improving Field Token support in the upcoming release, but there's no guarantee as I am just consuming tokens defined by other modules and as I said, current state is not good.

Hope this helped.

Cheers,
Deciphered.

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