Commit 7dcdcebd authored by Kevin Stover's avatar Kevin Stover

Moved functions that were specific to the Conditional Logic extension out of...

Moved functions that were specific to the Conditional Logic extension out of core and into that extension.
parent cb5e7ab5
......@@ -78,94 +78,6 @@ function ninja_forms_delete_form( $form_id = '' ){
}
add_action('wp_ajax_ninja_forms_add_conditional', 'ninja_forms_add_conditional');
function ninja_forms_add_conditional(){
global $wpdb, $ninja_forms_fields;
$field_id = $_REQUEST['field_id'];
$x = $_REQUEST['x'];
ninja_forms_field_conditional_output($field_id, $x);
die();
}
add_action('wp_ajax_ninja_forms_add_cr', 'ninja_forms_add_cr');
function ninja_forms_add_cr(){
global $wpdb, $ninja_forms_fields;
$field_id = $_REQUEST['field_id'];
$x = $_REQUEST['x'];
$y = $_REQUEST['y'];
$new_html = ninja_forms_return_echo('ninja_forms_field_conditional_cr_output', $field_id, $x, $y);
header("Content-type: application/json");
$array = array ('new_html' => $new_html, 'field_id' => $field_id, 'x' => $x, 'y' => $y);
echo json_encode($array);
die();
}
add_action('wp_ajax_ninja_forms_change_action', 'ninja_forms_change_action');
function ninja_forms_change_action(){
global $wpdb, $ninja_forms_fields;
$form_id = $_REQUEST['form_id'];
$action_slug = $_REQUEST['action_slug'];
$field_id = $_REQUEST['field_id'];
$x = $_REQUEST['x'];
$field_data = $_REQUEST['field_data'];
$field_data = $field_data['ninja_forms_field_'.$field_id];
$field_row = ninja_forms_get_field_by_id($field_id);
$type = $field_row['type'];
$reg_field = $ninja_forms_fields[$type];
if( isset( $reg_field['conditional']['action'][$action_slug] ) ){
$conditional = $reg_field['conditional']['action'][$action_slug];
}else if( $action_slug == 'change_value'){
$conditional = array( 'output' => 'text' );
}else{
$conditional = '';
}
header("Content-type: application/json");
if( isset( $conditional['output'] ) ){
$new_type = $conditional['output'];
}else{
$new_type = '';
}
$new_html = ninja_forms_return_echo( 'ninja_forms_field_conditional_action_output', $field_id, $x, $conditional, '', $field_data );
$array = array('new_html' => $new_html, 'new_type' => $new_type );
echo json_encode($array);
die();
}
add_action('wp_ajax_ninja_forms_change_cr_field', 'ninja_forms_change_cr_field');
function ninja_forms_change_cr_field(){
global $wpdb, $ninja_forms_fields;
$field_id = $_REQUEST['field_id'];
$field_value = $_REQUEST['field_value'];
$x = $_REQUEST['x'];
$y = $_REQUEST['y'];
$field_row = ninja_forms_get_field_by_id($field_value);
$type = $field_row['type'];
$reg_field = $ninja_forms_fields[$type];
$conditional = $reg_field['conditional'];
header("Content-type: application/json");
$new_html = '';
if(isset($conditional['value']) AND is_array($conditional['value'])){
$new_html = ninja_forms_return_echo('ninja_forms_field_conditional_cr_value_output', $field_id, $x, $y, $conditional);
$array = array('new_html' => $new_html, 'new_type' => $conditional['value']['type'] );
echo json_encode($array);
}
die();
}
add_action('wp_ajax_ninja_forms_add_list_option', 'ninja_forms_add_list_options');
function ninja_forms_add_list_options(){
global $wpdb;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment