Closed (fixed)
Project:
ImageCache Actions
Version:
7.x-1.x-dev
Component:
Text Effects Module
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
10 May 2011 at 13:16 UTC
Updated:
12 Jul 2013 at 19:21 UTC
Jump to comment: Most recent file
Comments
Comment #1
dman commentedIf you have a node object that you need to pull some arbitrary data out of, you'll have to use the data array that it gives you.
The structure of the way a $node presents its taxonomy terms can be seen if you enable the devel.module.
I imagine you want something like
We don't have token support, though it may be possible one day
Comment #2
fietserwinThe 6.x-2.x is not supported anymore and we are closing all issues for it.
If programming a PHP snippet for either a text effect or a custom action, I don't see why you would need token support. You have the data available, or at least have a starting point to fetch the required and related data. And subsequently it is just extracting that data. On the other hand, if token support allows to outsource the hard work of getting related data, than that could be very easy and very powerful. Still, I would think that there already must be some kind of token API that already offers this in a programmatic way, thus readily available in your snippets.
Please feel free to reopen against the 7.x-1.x branch if you want the feature implemented over there.
Comment #3
dman commentedToken support for textactions is a natural fit, I think.
It would ease up a LOT of the currently very fiddly ways of getting at $node data, and system strings as well for that matter.
It would make most text actions possible without exposing PHP code format (!)
And be self-documenting somewhat. Much better than the current situation.
Basically, the textarea where we can add text is either plaintext or php-evaluated.
It should be easy to process tokens found within the plaintext, seeded with token replacements generated from the $node object where possible.
I'd keep this on the TODO list as it's a good goal.
Comment #4
dman commentedD7
Comment #5
dman commentedtitle
Comment #6
fietserwinI see, I was thinking of token suppor tin the PHP case, but for the "plain text" case this would indeed be great. That would make the current special cases (image alt and title) redundant. Moving to text module.
Comment #7
derhasi commentedI managed to implement token replacement. I built it to use file_entity fields, but it should work fine without file_entity enabled.
The patch is attached
Comment #8
ryan.ryan commentedYo, this patch applied cleanly and enabled token support for me. Not throwing any errors either. Seems RTBC.
Comment #9
fietserwinI made some changes to the latest patch here:
Before committing this, I want to get some advice on:
Comment #10
arx-e commentedi have applied the patch in #9 (1152736-9.patch) to the latest dev version and I am using the text effect to watermark photos with the photographers name from a term reference field of the same node.
It works like a charm in my first tests!
A great feature for the site I am building and big thank you to the above contributors!
Should definitely be part of the module.
Comment #11
fietserwinCommitted a final version that differs from #9 in the fact that the "static text" and "token" options are merged into 1 option.