| @@ -538,11 +538,30 @@ | ||
| 538 | 538 | } |
| 539 | 539 | } |
| 540 | 540 | } |
| 541 | 541 | |
| 542 | - $page_break_settings = defined( 'SRFM_PRO_VER' ) && apply_filters( 'srfm_use_page_break_layout', true ) ? get_post_meta( $id, '_srfm_page_break_settings', true ) : []; | |
| 543 | - $page_break_settings = ! empty( $page_break_settings ) && is_array( $page_break_settings ) ? $page_break_settings : []; | |
| 544 | - $is_page_break = ! empty( $page_break_settings ) ? $page_break_settings['is_page_break'] : false; | |
| 542 | + $page_break_settings = defined( 'SRFM_PRO_VER' ) && apply_filters( 'srfm_use_page_break_layout', true ) ? get_post_meta( $id, '_srfm_page_break_settings', true ) : []; | |
| 543 | + $page_break_settings = ! empty( $page_break_settings ) && is_array( $page_break_settings ) ? $page_break_settings : []; | |
| 544 | + $is_page_break = ! empty( $page_break_settings ) ? $page_break_settings['is_page_break'] : false; | |
| 545 | + // Auto-advance is read here rather than in Pro's button renderer because | |
| 546 | + // save & resume replaces that whole container through the | |
| 547 | + // srfm_page_break_buttons_html filter, which would drop the attributes. | |
| 548 | + // The form tag is rendered exactly once and is already how both step | |
| 549 | + // runtimes receive their per-form settings (form-id, ajaxurl, | |
| 550 | + // data-submit-token). | |
| 551 | + // | |
| 552 | + // Two stored settings rather than one because the two layouts are | |
| 553 | + // mutually exclusive: Pro filters srfm_use_page_break_layout to false | |
| 554 | + // when the conversational layout is on, so $page_break_settings is | |
| 555 | + // empty there and its editor panel is hidden. Each layout keeps the | |
| 556 | + // toggle with the rest of its own settings, and only one can apply. | |
| 557 | + $conversational_settings = defined( 'SRFM_PRO_VER' ) ? get_post_meta( $id, '_srfm_conversational_form', true ) : []; | |
| 558 | + $conversational_settings = ! empty( $conversational_settings ) && is_array( $conversational_settings ) ? $conversational_settings : []; | |
| 559 | + $is_conversational = ! empty( $conversational_settings['is_cf_enabled'] ); | |
| 560 | + $active_step_settings = $is_conversational ? $conversational_settings : ( $is_page_break ? $page_break_settings : [] ); | |
| 561 | + $auto_advance_key = $is_conversational ? 'cf_auto_advance' : 'auto_advance'; | |
| 562 | + $auto_advance = ! empty( $active_step_settings[ $auto_advance_key ] ); | |
| 563 | + $auto_advance_hide_next = $auto_advance && ! empty( $active_step_settings[ $auto_advance_key . '_hide_next' ] ); | |
| 545 | 564 | $page_break_progress_type = ! empty( $page_break_settings ) ? $page_break_settings['progress_indicator_type'] : 'none'; |
| 546 | 565 | $form_confirmation = get_post_meta( $id, '_srfm_form_confirmation' ); |
| 547 | 566 | $confirmation_type = ''; |
| 548 | 567 | $submission_action = ''; |
| @@ -878,9 +897,9 @@ | ||
| 878 | 897 | self::render_edit_form_button( (int) $id ); |
| 879 | 898 | |
| 880 | 899 | ?> |
| 881 | 900 | <form method="post" enctype="multipart/form-data" id="srfm-form-<?php echo esc_attr( Helper::get_string_value( $id ) ); ?>" class="srfm-form <?php echo esc_attr( 'sureforms_form' === $post_type ? 'srfm-single-form ' : '' ); ?>" |
| 882 | - form-id="<?php echo esc_attr( Helper::get_string_value( $id ) ); ?>" after-submission="<?php echo esc_attr( $submission_action ); ?>" message-type="<?php echo esc_attr( $confirmation_type ? $confirmation_type : 'same page' ); ?>" success-url="<?php echo esc_attr( $success_url ? $success_url : '' ); ?>" ajaxurl="<?php echo esc_url( admin_url( 'admin-ajax.php' ) ); ?>" data-submit-token="<?php echo esc_attr( $submit_token ); ?>" data-view-token="<?php echo esc_attr( $view_token ); ?>" | |
| 901 | + form-id="<?php echo esc_attr( Helper::get_string_value( $id ) ); ?>" after-submission="<?php echo esc_attr( $submission_action ); ?>" message-type="<?php echo esc_attr( $confirmation_type ? $confirmation_type : 'same page' ); ?>" success-url="<?php echo esc_attr( $success_url ? $success_url : '' ); ?>" ajaxurl="<?php echo esc_url( admin_url( 'admin-ajax.php' ) ); ?>" data-submit-token="<?php echo esc_attr( $submit_token ); ?>" data-view-token="<?php echo esc_attr( $view_token ); ?>"<?php echo $auto_advance ? ' data-srfm-auto-advance="1"' : ''; ?><?php echo $auto_advance_hide_next ? ' data-srfm-hide-next="1"' : ''; ?> | |
| 883 | 902 | > |
| 884 | 903 | <?php |
| 885 | 904 | // Submission security is handled via the HMAC token in data-submit-token. |
| 886 | 905 | $global_setting_options = get_option( 'srfm_security_settings_options' ); |