| @@ -149,8 +149,19 @@ | ||
| 149 | 149 | |
| 150 | 150 | wp_enqueue_script( SRFM_SLUG . $form_editor_script, SRFM_URL . 'assets/build/formEditor.js', $script_info['dependencies'], $script_info['version'], true ); |
| 151 | 151 | wp_localize_script( SRFM_SLUG . $form_editor_script, 'scIcons', [ 'path' => SRFM_URL . 'assets/build/icon-assets' ] ); |
| 152 | 152 | |
| 153 | + // Deep-link (#3030): the "Finish setting up" Thank You notice CTA opens this | |
| 154 | + // editor with ?srfm_focus=… to auto-open a settings tab. Gutenberg strips | |
| 155 | + // unrecognised query args client-side before the editor bundle can read them, | |
| 156 | + // so surface the value from the server — where it is never stripped — as a | |
| 157 | + // global the bundle reads at evaluation time. Validated to a known allowlist. | |
| 158 | + // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Read-only deep-link hint on an authenticated editor screen; no state change. | |
| 159 | + $srfm_focus = isset( $_GET['srfm_focus'] ) ? sanitize_key( wp_unslash( $_GET['srfm_focus'] ) ) : ''; | |
| 160 | + if ( in_array( $srfm_focus, [ 'thankyou', 'notifications' ], true ) ) { | |
| 161 | + wp_add_inline_script( SRFM_SLUG . $form_editor_script, 'window.srfmDeepLinkFocus = ' . wp_json_encode( $srfm_focus ) . ';', 'before' ); | |
| 162 | + } | |
| 163 | + | |
| 153 | 164 | // Enqueue the code editor for the Custom CSS Editor in SureForms. |
| 154 | 165 | wp_enqueue_code_editor( [ 'type' => 'text/css' ] ); |
| 155 | 166 | wp_enqueue_script( 'wp-theme-plugin-editor' ); |
| 156 | 167 | wp_enqueue_style( 'wp-codemirror' ); |