Issue: Currently when providing replacements using token.module, ctools only uses the first set of tokens returned. For node tokens, this eliminates any field tokens added by CCK.

Fix: Instead of using reset() to only grab the first set of tokens returned by token_get_list(), ctools should iterate over each token category so that any additional tokens provided by other modules (such as CCK) will be added to the list.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

joshuajabbour’s picture

Status: Active » Needs review
FileSize
3.83 KB

The attached patch fixes this issue for node, user, and token (global) converters.

deleuje’s picture

I was just about to abandon Panels once again for template files.
This patch saved me.

Thanks!

james.williams’s picture

+1

spuky’s picture

This Patch helpt to get CCK fields in Panels context...

joshuajabbour’s picture

if you've reviewed and applied this patch and not found any bugs, please mark RTBC

bludrop’s picture

I applied the patch, however I can't figure out how to include CCK fields in my panels content. The "substitutions" list doesn't include any of the CCK field tokens, it just has the few %node keywords.

How can I use a keyword to display content from CCK fields?

Jim Kirkpatrick’s picture

+1

joshuajabbour’s picture

rerolled patch

Jim Kirkpatrick’s picture

Status: Needs review » Reviewed & tested by the community

#8 Works well for me, thanks Joshua.

Letharion’s picture

Status: Reviewed & tested by the community » Needs work

Doesn't the output get rather messy though?
For example when I have three different vocabularies that I can tag a node with, I get:
Name of terms vocabulary
Name of terms vocabulary
Name of terms vocabulary
Kinda hard to tell which selection comes from which vocabulary. And I get a lot of those identical triplets.
I'll see if I can work it out.

merlinofchaos’s picture

We might need to do this in 2 phases. Go ahead and properly open it up so that all tokens are available, and then allow token categorization. Though I dunno if the necessary text will be available.

Letharion’s picture

FileSize
109.71 KB

token_get_list() does not provide enough information by itself to properly identify the options.
However, just removing reset() will provide something looking like the attached screenshot.

Letharion’s picture

I just realized that my approach does not play well with the panels ui.

Itangalo’s picture

subscribing

joshuajabbour’s picture

Yes, as per #12, token.module itself doesn't provide enough metadata to make useful labels. It def makes the UI confusing, but it is better to have a confusing UI, or a bunch of unavailable data? I don't know...

Itangalo’s picture

@joshuajabbour: A confusing UI has always been preferred over unavailable data in the Drupal world, as far as I know. And I'm all in favour. :-)

ayalon’s picture

At the moment, it is not possible to pass a CCK Value (for example the year of a date field) to a view.

The proposed patch has some problems if you have multiple cck fields with the same field type. You will have duplicate entries and cannot determine the according field.

My patch adds the field name. Now you can easily determine the correct token.

Anonymous’s picture

Status: Needs work » Needs review

+1

james.williams’s picture

Anyone interested in getting this functionality for D7 should take a look at #691078: Field tokens. It's currently at nearly 300 comments though! The patch for Token module in http://drupal.org/node/691078#comment-4139738 looks to be the best progress so far. Note that CTools uses the core token system in D7.

Jim Kirkpatrick’s picture

Status: Needs review » Reviewed & tested by the community

Patch in #17 works like a dream on toast. Please commit!

PierreMarcel’s picture

I second the patch on #17 it works great so far, but still on a staging site... after applied it list all the cck fields available in panels, great job Ayalon thanks for the patch!

Dave Reid’s picture

Re #19: That shouldn't be necessary for CTools in D7 now that we have properly nestable tokens. People cannot and should not just create arbitrary token categories that still mean 'node' in D7.

sketman’s picture

I applied patch in post #17 but it did not work for me. No new tokens are available in Panels as contexts. It was my first patching experience, however. Even I did not get any error message during, I could do something wrong.
Guys, dont wanna bothering, but could you somebody attach here patched node.inc file please?
Thanks in advance...

rootwork’s picture

Priority: Normal » Major

Patch worked for me as well. Would love to see this get applied.

@sketman: The patch actually modifies three files: node.inc, user.inc and token.inc. Maybe that's the trouble you're running into?

Summit’s picture

Hi, Is this patch also committed to D7 please?
Would love to use the token-replacement also in D7.
Thanks a lot in advance for your reply in advance.
Greetings, Martijn

letapjar’s picture

The patch in #17 works great - please commit to the next point release.

merlinofchaos’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed.

Status: Fixed » Closed (fixed)

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