| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) { |
| 3 |
die( 'You are not allowed to call this page directly.' ); |
| 4 |
} |
| 5 |
// This partial view is used in the visual styler. This view renders a container for both the target form and the sample form previews. |
| 6 |
// It also includes the toggle to switch between the two views as only a single one is displayed at a time. |
| 7 |
// It is accessed from /wp-admin/admin.php?page=formidable-styles&form=782 |
| 8 |
|
| 9 |
$sample_form_is_on = 1 === FrmAppHelper::simple_get( 'sample', 'absint' ); |
| 10 |
$sample_toggle_text = $sample_form_is_on ? __( 'View my form', 'formidable' ) : __( 'View sample form', 'formidable' ); |
| 11 |
$active_form_wrapper_params = array( |
| 12 |
'id' => 'frm_active_style_form', |
| 13 |
); |
| 14 |
if ( $sample_form_is_on ) { |
| 15 |
$active_form_wrapper_params['class'] = 'frm_hidden'; |
| 16 |
} |
| 17 |
?> |
| 18 |
<div id="frm_style_preview"> |
| 19 |
<div class="frm-m-12 frm-mt-0"> |
| 20 |
<?php |
| 21 |
// If a $message, $warnings, or $notes variable are not empty, it will be rendered here. |
| 22 |
include FrmAppHelper::plugin_path() . '/classes/views/shared/errors.php'; |
| 23 |
?> |
| 24 |
<?php |
| 25 |
// If Pro is not active, this will show an upsell. |
| 26 |
FrmTipsHelper::pro_tip( 'get_styling_tip', 'p' ); |
| 27 |
?> |
| 28 |
<div id="frm_broken_styles_warning" class="frm_warning_style"> |
| 29 |
<?php esc_html_e( 'One or more of your style settings may contain invalid characters that break form styling.', 'formidable' ); ?> |
| 30 |
</div> |
| 31 |
<div <?php FrmAppHelper::array_to_html_params( $active_form_wrapper_params, true ); ?>> |
| 32 |
<?php |
| 33 |
// The right side body shows a preview (of the target form) so you can see the form you're actually styling. |
| 34 |
echo $target_form_preview_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 35 |
?> |
| 36 |
</div> |
| 37 |
<?php |
| 38 |
// Add a sample form to toggle between. This is toggled by the #frm_toggle_sample_form below this and is hidden by default. |
| 39 |
?> |
| 40 |
<div id="frm_sample_form"> |
| 41 |
<?php |
| 42 |
$frm_settings = FrmAppHelper::get_settings(); |
| 43 |
include $style_views_path . '_sample_form.php'; |
| 44 |
unset( $frm_settings ); |
| 45 |
?> |
| 46 |
</div> |
| 47 |
<?php if ( 'edit' !== $view ) { ?> |
| 48 |
<a href="<?php echo esc_url( admin_url( 'admin.php?page=formidable-styles&frm_action=edit&form=' . $form->id ) ); ?>" id="frm_edit_style" class="frm_floating_style_button button frm-button-secondary frm-with-icon" tabindex="0" role="button"> |
| 49 |
<?php FrmAppHelper::icon_by_class( 'frmfont frm_pencil_icon', array( 'echo' => true ) ); ?> <?php esc_html_e( 'Edit style', 'formidable' ); ?> |
| 50 |
</a> |
| 51 |
<?php } ?> |
| 52 |
<button id="frm_toggle_sample_form" class="frm_floating_style_button button frm-button-secondary frm-with-icon"> |
| 53 |
<?php FrmAppHelper::icon_by_class( 'frmfont frm_sample_form_icon', array( 'echo' => true ) ); ?> <span><?php echo esc_html( $sample_toggle_text ); ?></span> |
| 54 |
</button> |
| 55 |
<?php |
| 56 |
/** |
| 57 |
* This is used in Pro to add a "Apply style" button to the preview. |
| 58 |
* |
| 59 |
* @since 6.0 |
| 60 |
* |
| 61 |
* @param string $view 'edit' or 'list'. |
| 62 |
*/ |
| 63 |
do_action( 'frm_style_preview_after_toggle', $view ); |
| 64 |
?> |
| 65 |
<div id="frm_loading_style_placeholder"> |
| 66 |
<span class="frm-wait frm_visible_spinner"></span> |
| 67 |
<strong><?php esc_html_e( 'Please wait', 'formidable' ); ?></strong> |
| 68 |
<p><?php esc_html_e( 'Updating CSS...', 'formidable' ); ?></p> |
| 69 |
</div> |
| 70 |
</div> |
| 71 |
</div> |
| 72 |
|