Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
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.
Comment | File | Size | Author |
---|---|---|---|
#8 | 531366.patch | 886 bytes | mikeker |
#4 | Picture-1.jpg | 194.25 KB | mongothemad |
Comments
Comment #1
merlinofchaos CreditAttribution: merlinofchaos commentedHmm. Context substitutions happen after php runs. So you can put them in the output, but not in the PHP input.
Comment #2
astreib CreditAttribution: astreib commentedI'm seeing this behavior in HTML custom content as well.... substitutions are not working in either the title or body fields.
Comment #3
merlinofchaos CreditAttribution: merlinofchaos commented#2: Just retested. I cannot duplicate. Make sure you have the checkbox checked so that substitutions will happen.
Comment #4
mongothemad CreditAttribution: mongothemad commentedI 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.
Comment #5
merlinofchaos CreditAttribution: merlinofchaos commented#4: Please reread #1.
Comment #6
mongothemad CreditAttribution: mongothemad commentedI 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.
Comment #7
merlinofchaos CreditAttribution: merlinofchaos commentedThey're not 'for' PHP. It just happens that you can put PHP there because it's typical filtered input.
Comment #8
mikeker CreditAttribution: mikeker commentedMoving 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:results in
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.Comment #9
merlinofchaos CreditAttribution: merlinofchaos commentedAfter thinking long and hard about this, I agree that I did this wrong originally. Committed to D6.
Comment #10
merlinofchaos CreditAttribution: merlinofchaos commentedAll of the 'to be ported' patches got merged in during the porting sprint in September.
Comment #11
mikeker CreditAttribution: mikeker commentedAssuming that the "duplicate" status was a mistake...
Comment #12
mautumn CreditAttribution: mautumn commentedI 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...
Comment #13
mikeker CreditAttribution: mikeker commented#12 has nothing to do with this issue. Please open a new feature request in the Views issue queue.
Comment #14
gillarf CreditAttribution: gillarf commentedi'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
Comment #15
merlinofchaos CreditAttribution: merlinofchaos commented-rc2 is out with over 100 commits since -rc1. You should update to -rc2 before posting bug reports.
Comment #16
elBradford CreditAttribution: elBradford commentedI'm reopening it - looks like it was never ported to 7. Substitutions are still not evaluated in PHP
Comment #17
thegreatone CreditAttribution: thegreatone commentedany idea when it is going to be ported?