/** * Set the form id for the repeating section and any fields inside it * * @since 2.0 */ public static function toggle_repeat() { check_ajax_referer('frm_ajax', 'nonce'); $form_id = absint($_POST['form_id']); // $form_id should be empty for non-repeating sections $parent_form_id = absint($_POST['parent_form_id']); $checked = absint($_POST['checked']); $new_form_name = sanitize_text_field($_POST['field_name']); // Switch to repeating if ($checked) { $form_id = FrmProField::create_repeat_form(0, array('parent_form_id' => $parent_form_id, 'field_name' => $new_form_name)); // New form_select echo $form_id; } if ($form_id) { $field_id = absint($_POST['field_id']); // get the array of child fields $children = array_filter((array) $_POST['children'], 'is_numeric'); if (!empty($children)) { FrmProFieldsHelper::update_for_repeat(compact('form_id', 'parent_form_id', 'checked', 'field_id', 'children')); } } wp_die(); }