I'm using current-page tokens for cach cid (using cache actions), on a custom panel page with tokens as a context.

The token is being removed, but not replaced with anything. I've tested this with %token:current-page:query and %token:current-page:url with the same results.

Other tokens such as %token:site:url work as expected.

Cheers

Comments

merlinofchaos’s picture

Are you sure this is really the -dev version: There are problems in 7.x-1.2 with chained tokens, but those are all fixed in the latest release, to my knowledge.

rafaqz’s picture

Title: current-page:x tokens not working » current-page:query:x token not working

I double checked some typos and its actually only happening in current-page:query:x, I've done a few tests replacing the token in custom content and it dosn't seem to work anywhere.

it is the current dev, but it seems to be a different problem as the other tokens are all working, maybe a tokens issue?

rafaqz’s picture

an example to illustrate the problem:

I put this substitution token somewhere substitutions are checked (in text, titles, cache cid etc...)

%token:current-page:query:foo

the page is loaded with a query string of ?foo=bar

But the substitution leaves no text, when it should return "bar"

Thats how it seems it should work from this test at least

rafaqz’s picture

Status: Active » Patch (to be ported)
StatusFileSize
new815 bytes

ctools_context_token_convert wasn't returning anything for tokens with three or more parts, here's a patch.

rafaqz’s picture

Status: Patch (to be ported) » Needs review

Status: Needs review » Needs work

The last submitted patch, ctools-current-page-query-not-returned-1964434-4.patch, failed testing.

rafaqz’s picture

Status: Needs work » Needs review
StatusFileSize
new743 bytes
merlinofchaos’s picture

Is it possible to get a token into there that won't explode correctly leaving parts[0] undefined and causing a notice error?

rafaqz’s picture

probably not, its copied from the validation in the token module.

token.module:651: $parts = explode(':', $token, 2);

token.module:653: if (!isset($token_info['tokens'][$type][$parts[0]])) {

moonray’s picture

Status: Needs review » Reviewed & tested by the community

The patch in #7 fixes the issue. Haven't noticed any errors/notices so far.

kalabro’s picture

The problem in current 7.x-1.x-dev code is that Ctools tries to check something like this query:foo instead of just query.

So #7 fixes problem and looks good.

kalabro’s picture

Title: current-page:query:x token not working » Token context: tokens with deep more then 1 don't work

Update title to clarify problem.

Tokens like:

%token:current-page:query:foo
%token:site:current-user:mail

aren't replaced by Token context. Patch from #7 fixes it.

johnennew’s picture

Confirm the patch in #7 fixes a bug when using path_breadcrumbs module and trying to access the current og_context via the site token:

%token:site:og-context--node:title
%token:site:og-context--node:url

Many thanks!

podarok’s picture

Assigned: Unassigned » merlinofchaos

#7 simple fix
RTBC

Jorrit’s picture

It works for me when accessing %token:current-page:query:xyz in a pane title, thanks! I wonder why the if (isset($tokens['tokens'][$real_type][$parts[0]])) { part is there at all. Does it hurt for the code to be a bit more optimistic and hand over everything to token_generate() without a check?

rafaqz’s picture

I was also wondering if we could just delete those lines as well, just left it in to be safe assuming someone had validation there for a reason. But token runs exactly the same validation immediately after this runs so its not really needed.

dillix’s picture

+1 for RTBC

ntigh52’s picture

dillix’s picture

dillix’s picture

2 merlinofchaos: is this patch on the latest dev?

japerry’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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