--- /Users/***/Desktop/workflow_ng_actions_original.inc +++ workflow_ng_actions.inc @@ -124,6 +124,12 @@ ), '#module' => t('User'), ), + 'workflow_ng_action_php' => array( + '#label' => t('Execute custom PHP code'), + //we are not working with defined arguments, instead we make use of all available arguments + '#arguments' => array(), + '#module' => t('Token'), + ), ); } @@ -738,3 +744,31 @@ function workflow_ng_condition_content_is_type_submit($form_id, $form_values) { return array('type' => $form_values['type']); } + +/* + * Action Implementation: Execute custom PHP code + */ +function workflow_ng_action_php($settings, &$arguments, &$log) { + $php = workflow_ng_token_replace($settings['php'], $settings['used_arguments'], $arguments, $log);include_once("../dBug.php"); + return drupal_eval($php); +} + +/* + * Action "Execute custom PHP code" configuration form + */ +function workflow_ng_action_php_form($settings = array(), $argument_info) { + $form = array(); + $form['php'] = array( + '#type' => 'textarea', + '#rows' => 12, + '#title' => t('PHP code'), + '#default_value' => $settings['php'], + '#description' => t('The code that should be executed. Surround the code in <?php and ?>. You can use Tokens as variable values (e.g.: print "hello [user:user]").'), + ); + workflow_ng_token_replacement_help($form, $argument_info); + return $form; +} + +function workflow_ng_action_php_submit($form_id, $form_values) { + return array('php' => $form_values['php'], 'used_arguments' => workflow_ng_token_get_used_arguments($form_values['php'], $form_values['arguments'])); +} \ No newline at end of file