In a node panel, if I try to use context substitutions (like %node:nid, %node:uid, and so on) when I create a new custom content, they are left as is. Of course you can get most of these through php, but it would be nice to avoid writing the extra code.

CommentFileSizeAuthor
#8 531366.patch886 bytesmikeker
#4 Picture-1.jpg194.25 KBmongothemad
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

merlinofchaos’s picture

Hmm. Context substitutions happen after php runs. So you can put them in the output, but not in the PHP input.

astreib’s picture

I'm seeing this behavior in HTML custom content as well.... substitutions are not working in either the title or body fields.

merlinofchaos’s picture

Status: Active » Postponed (maintainer needs more info)

#2: Just retested. I cannot duplicate. Make sure you have the checkbox checked so that substitutions will happen.

mongothemad’s picture

Version: 6.x-3.0-rc1 » 6.x-3.1
Status: Postponed (maintainer needs more info) » Active
FileSize
194.25 KB

I am having this trouble as well. I have included a screenshot.

%node:nid does not print anything and the end result is whatever in found in this content is completely removed from the final output. If I remove the $node = node_load(%node:nid); no substitution takes place.

merlinofchaos’s picture

#4: Please reread #1.

mongothemad’s picture

I got what I wanted to do using an alternative method (explained http://drupal.org/node/610588#comment-2177344 )

What I don't understand is why have substitutions for PHP if they cannot work dynamically? It seems that the tokens module was able to do this.

merlinofchaos’s picture

Status: Active » Closed (works as designed)

They're not 'for' PHP. It just happens that you can put PHP there because it's typical filtered input.

mikeker’s picture

Project: Panels » Chaos Tool Suite (ctools)
Version: 6.x-3.1 » 6.x-1.3
Component: Plugins - contexts » Code
Status: Closed (works as designed) » Needs review
FileSize
886 bytes

Moving to the ctools queue as that's where the underlying issue is.

Substitutions also fail in some other formats because the substitution takes place after check_markup. Eg:

<p class="taxonomy-term-%taxonomy:name">%taxonomy:name</p>

results in

<p class="taxonomy-term-name">Correct substitution here</p>

I've attached a patch that fixes this by putting the keyword substitution before check_markup.

It may cause odd substitutions if someone is using %taxonomy as actual PHP code (though I'm not sure it's even valid...) in their snippet, but I imagine that's distant edge case.

merlinofchaos’s picture

Version: 6.x-1.3 » 7.x-1.x-dev
Status: Needs review » Patch (to be ported)

After thinking long and hard about this, I agree that I did this wrong originally. Committed to D6.

merlinofchaos’s picture

Status: Patch (to be ported) » Closed (duplicate)

All of the 'to be ported' patches got merged in during the porting sprint in September.

mikeker’s picture

Status: Closed (duplicate) » Closed (fixed)

Assuming that the "duplicate" status was a mistake...

mautumn’s picture

Version: 7.x-1.x-dev » 6.x-1.x-dev
Category: bug » feature
Status: Closed (fixed) » Active

I think the inclusion of the $data equivalent of the exposed Views results variable would make this excellent piece of software even better... Or if the $data available in Views could be made accessible in Panels via something like a hashmap - e.g. $viewdata1 = $panelviewdata['viewname1'], $viewdata1 = $panelviewdata['viewname2'], etc...

mikeker’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev
Category: feature » bug
Status: Active » Closed (fixed)

#12 has nothing to do with this issue. Please open a new feature request in the Views issue queue.

gillarf’s picture

i've noticed this works now in D6 but not in D7.

i.e. I can incorporate substitutions in php on D6 sites, but not in D7

I'm using 7.x-1.0-rc1

merlinofchaos’s picture

-rc2 is out with over 100 commits since -rc1. You should update to -rc2 before posting bug reports.

elBradford’s picture

Version: 7.x-1.x-dev » 7.x-1.0
Status: Closed (fixed) » Patch (to be ported)

I'm reopening it - looks like it was never ported to 7. Substitutions are still not evaluated in PHP

thegreatone’s picture

Issue summary: View changes

any idea when it is going to be ported?