Hi,
This is my first time submitting so please excuse anything I mis-state or that I've repeated. I'm in desperate need of some assistance. This module sounded like the answer to my prayers. Here's my scenario:

I have a file field, in which a PDF is uploaded. I'm using this file field to output in a Views block. Instead of using the generic formatter that ships with core, I really wanted to create a custom formattter that renders something like this:
<a href="/path/to/file/file.pdf">Presentation Only (PDF, 1.3MB)</a>

To that end, I installed the Custom Formatters module, and set about creating my formatter, using HTML+Tokens.

I've name my formatter "presentation_only"
Format is set to HTML+Tokens
Field Types is set to "File"

And then I've written my formatter like this:

<span class="file">
<img class="file-icon" src="/modules/file/icons/application-pdf.png" title="[file:mime]" alt="">
<a href="[file:path]">Presentation Only (<span class="pres-extension">[file:extension]</span>, <span class="pres-file-size">[file:size]</span>)</a>
</span>

I think everything should be fine, but in both the NODE view and the Views block, when I've selected my custom formatter, the output looks like this:

Presentation Only ([file:extension], [file:size])

Rendering the tokens instead of the proper values/content. Help please!

Comments

mstrelan’s picture

I seem to get the same with the default image token example.

Snakehead’s picture

I have the same problem, with References to Users and Nodes. I discovered an Issue where a Configuration of Display for Tokens is mentioned but I do not find the Display configuration for Tokens.
Anyway this module could be for me and probably all others a killer module because it could be/is extremly useful.
A Hint for our problems could be helpful. The Advanced help doesn't deliver any help (sorry).

westie’s picture

Also same problem, however i got the below error:

Notice: Undefined index: node in _custom_formatters_preview_variables() (line 231 of /.../sites/all/modules/custom_formatters/plugins/export_ui/custom_formatters.inc).
Warning: array_keys() expects parameter 1 to be array, null given in _custom_formatters_preview_variables() (line 231 of /.../sites/all/modules/custom_formatters/plugins/export_ui/custom_formatters.inc).

&

Notice: Undefined index: export in ctools_export_crud_load() (line 75 of /.../sites/all/modules/ctools/includes/export.inc).

However, what I find strange is the Tokens work perfectly on another site with almost exactly the same modules installed....

lanny heidbreder’s picture

Category: support » bug
Priority: Normal » Major

I had the errors reported in #3 when using 7.x-2.0, but they went away when using the dev version from February 18. However, I have the same problem with the tokens not being replaced, even in the default example formatter. It seems that the tokens in the example don't work at all; they're not listed in the table with all the rest of the tokens.

deciphered’s picture

The issue is related to an issue with Token, the specific field tokens aren't part of the token module. There was a working patch a while back, which I believe got neutered...

I will look further into this as it is a very big issue in my opinion as well.

deciphered’s picture

Status: Active » Fixed

The tokens in the original post are for the File entity, not for a File field. There was chained token support in a Token patch which would have been used for this sort of thing, but unfortunately they where never committed.

7.x-2.x-dev contains support for the Entity tokens module (part of the Entity module) that allows chained tokens, so if you are formatting a File field and you want to render the file name or file type you can get those values using the 'List of file fields' token type; [list:0:name], etc.

More work is planned for 7.x-2.2 around Tokens.

Status: Fixed » Closed (fixed)

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