evf-form-preview-embed.php
42 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Minimal form preview — the form ONLY, no toolbar/device-switcher/shortcode-box/side |
| 4 | * panel. Used when ?evf_preview_mode=embed is passed alongside ?evf_preview=true&form_id=, |
| 5 | * e.g. by the "Create with AI" screen's own preview iframe (it already renders its own |
| 6 | * chrome around the iframe). The full-chrome template (evf-form-preview-template.php) |
| 7 | * remains the default — the builder toolbar's "Preview" link deliberately opens that one |
| 8 | * in a new tab as a standalone page. |
| 9 | */ |
| 10 | defined( 'ABSPATH' ) || exit; |
| 11 | ?> |
| 12 | <!DOCTYPE html> |
| 13 | <html <?php language_attributes(); ?>> |
| 14 | <head> |
| 15 | <meta name="viewport" content="width=device-width"/> |
| 16 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> |
| 17 | <?php |
| 18 | wp_head(); |
| 19 | wp_print_head_scripts(); |
| 20 | ?> |
| 21 | </head> |
| 22 | <?php |
| 23 | if ( ! current_user_can( 'manage_options' ) && ! current_user_can( 'everest_forms_view_forms' ) ) { |
| 24 | echo '<div style="width: 100%; height: 100vh; display: flex; justify-content: center; align-items: center; font-size: 20px; font-weight: 600;">'; |
| 25 | echo esc_html__( "You don't have permission to view this page.", 'everest-forms' ); |
| 26 | echo '</div>'; |
| 27 | exit; |
| 28 | } |
| 29 | ?> |
| 30 | <body class="evf-form-preview-embed"> |
| 31 | <?php echo $form_content; // phpcs:ignore ?> |
| 32 | </body> |
| 33 | <?php |
| 34 | wp_footer(); |
| 35 | if ( function_exists( 'wp_print_media_templates' ) ) { |
| 36 | wp_print_media_templates(); |
| 37 | } |
| 38 | wp_print_footer_scripts(); |
| 39 | ?> |
| 40 | </html> |
| 41 | <?php |
| 42 |