You are here

function rules_action_custom_php_form in Rules 6

Execute custom php code action configuration form.

Related topics

File

rules/modules/php.rules_forms.inc, line 52
Rules configuration forms for the php module

Code

function rules_action_custom_php_form($settings, &$form, $form_state) {
  $form['settings']['code'] = array(
    '#type' => 'textarea',
    '#title' => t('PHP Code'),
    '#default_value' => isset($settings['code']) ? $settings['code'] : '',
    '#description' => t("The code that should be executed. Don't include <?php ?> delimiters."),
    '#required' => TRUE,
  );

  // add help including some info for saving the variables
  $variables = $form_state['proxy']
    ->get_available_variables($form_state['element']['#id']);
  $help = rules_input_evaluator_php_help($variables, TRUE);
  $form['input_help']['rules_input_evaluator_php']['#collapsed'] = FALSE;
  $form['input_help']['rules_input_evaluator_php']['content'] = array(
    '#value' => $help,
  );
}