Closed (fixed)
Project:
Rules
Version:
7.x-2.x-dev
Component:
Rules Core
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
2 Jan 2013 at 15:44 UTC
Updated:
19 Jul 2019 at 00:49 UTC
Jump to comment: Most recent
Comments
Comment #1
phazerz commentedI second that !
I thought I could "output" my custom PHP code in an added variables but apprently it don't..
Thank you in advance too.
Comment #2
tuccio commentedTry creating a global variable in the php action and then retrieve that global variable in the variable assignment php evaluation.
Comment #3
rbrownellDid you ever get this figured out?
Comment #4
rbrownellNot sure if this helps but you can use PHP to generate the output of the "Add a variable" action (for text).
Comment #5
candelas commented@rbrownell thanks
i was hours looking for this and this way it works. i could pass an nodes array saying that the variable was a text. i was trying to do it with a variable list of nodes and, there, there was not a a php evaluation.
now i can continue :)
Comment #6
rbrownellRules is very specific with what field types can have PHP evaluation. Much to my frustration it seems to only allows for text to have embedded php evaluation. Other field types like numbers, dates and integers and lists you can't perform any php evaluation. There is however a way to convert text into a list using Rules Data Transformations... After working with it for the last four months I must say Rules is not for the faint of heart.
Comment #7
brendanrjohn commentedMy solution may not apply in all cases, but I created a field with the relevent data type and hid it from display on the form and on the node display. I could set the value of this field using custom php and then use the data in subsequent actions.
Comment #8
lolandese commentedA new helper module might be the solution for some here. See https://www.drupal.org/project/rules_set_site_variables.
Comment #9
delacosta456 commentedHi (it tooks me hours too)
For more precision in case anyone confuse like me..(it may help)
Add an "Action" of variable of type text .. --save
Add an "Action" and choose the variable you just added above..
For the Value , switch to direct input and write your php avaluation code inside
....like like shown below AND IMPORTANT MAKE SURE AT THE END YOU RETURN NECAESSRY VARIABLE :Example
Comment #10
tr commentedThis seems to have been answered by #9.