You are here

function rules_input_evaluator_php_apply in Rules 6

Apply the input evaluator.

Parameters

$string: The string to evaluate.

$data: The data as returned from the prepare() callback.

$state: The current evaluation state.

$return_output: Whether to return the output of the PHP code or the data the code returns, which is used by the "Custom PHP action".

Related topics

2 calls to rules_input_evaluator_php_apply()
rules_action_custom_php in rules/modules/php.rules.inc
Custom php action: Fires up the input evaluator manually and returns it's return value.
rules_condition_custom_php in rules/modules/php.rules.inc
Custom php condition: Fires up the input evaluator manually and returns it's return value.

File

rules/modules/php.rules.inc, line 61
rules integration for the php module This provides an php input evaluator as well as a execute php code action.

Code

function rules_input_evaluator_php_apply($string, $data = NULL, &$state, $return_output = TRUE) {
  $vars = array();
  if ($data) {
    $vars = rules_get_variables(drupal_map_assoc($data), $state);
    if (!$vars) {
      rules_log(t('PHP is not evaluated as there are not all necessary variables available.'));
      return FALSE;
    }
  }
  $function = $return_output ? 'rules_php_eval' : 'rules_php_eval_return';
  return $function($string, $vars);
}