You are here

function rules_admin_form_clone in Rules 6

Clones a rule

1 string reference to 'rules_admin_form_clone'
rules_admin_menu in rules_admin/rules_admin.module
Implementation of hook_menu().

File

rules_admin/rules_admin.rule_forms.inc, line 861

Code

function rules_admin_form_clone(&$form_state, $proxy) {
  drupal_add_js(drupal_get_path('module', 'rules_admin') . '/rules_admin.js');
  $form_state['proxy'] =& $proxy;
  $rule = $proxy
    ->get_rule();
  _rules_element_defaults($rule);
  $rule['#name'] = drupal_substr($proxy
    ->get_rule_name(), drupal_strlen('rules_')) . '_cloned';
  if (!$form_state['post']) {
    drupal_set_message(t('Alter the settings for the cloned rule.'));
  }
  $form_state['set'] = strpos($rule['#set'], 'event_') !== 0;
  $form = rules_admin_form_rule_settings($rule, $form_state['set']);
  $form['#submit'] = array(
    'rules_admin_form_add_rule_submit',
  );
  return $form;
}