| 1 |
<?php |
| 2 |
/** |
| 3 |
* Test Mode Container. |
| 4 |
* |
| 5 |
* @package Formidable |
| 6 |
*/ |
| 7 |
|
| 8 |
if ( ! defined( 'ABSPATH' ) ) { |
| 9 |
die( 'You are not allowed to call this page directly.' ); |
| 10 |
} |
| 11 |
|
| 12 |
if ( ! empty( $should_show_warning ) ) { |
| 13 |
?> |
| 14 |
<div class="frm_warning_style" style="display: flex;"> |
| 15 |
<?php if ( $should_suggest_test_mode_install ) { ?> |
| 16 |
<?php esc_html_e( 'To use this feature, please install and activate the Testing Mode add-on.', 'formidable' ); ?> |
| 17 |
<span <?php FrmAppHelper::array_to_html_params( $test_mode_install_span_attrs, true ); ?>> |
| 18 |
<?php |
| 19 |
FrmAddonsController::conditional_action_button( |
| 20 |
'test-mode', |
| 21 |
array( |
| 22 |
'medium' => 'test-mode', |
| 23 |
'class' => 'frm-button-primary', |
| 24 |
) |
| 25 |
); |
| 26 |
?> |
| 27 |
</span> |
| 28 |
<?php } elseif ( $should_suggest_ai_install ) { ?> |
| 29 |
<?php esc_html_e( 'To autofill forms using AI, please install and activate the AI add-on.', 'formidable' ); ?> |
| 30 |
<span <?php FrmAppHelper::array_to_html_params( $ai_install_span_attrs, true ); ?>> |
| 31 |
<?php |
| 32 |
FrmAddonsController::conditional_action_button( |
| 33 |
'ai', |
| 34 |
array( |
| 35 |
'medium' => 'ai-autofill', |
| 36 |
'class' => 'frm-button-primary', |
| 37 |
) |
| 38 |
); |
| 39 |
?> |
| 40 |
</span> |
| 41 |
<?php }//end if ?> |
| 42 |
</div> |
| 43 |
<?php |
| 44 |
}//end if |
| 45 |
?> |
| 46 |
<div id="frm_testing_mode"> |
| 47 |
<h2><?php esc_html_e( 'Testing Mode Controls', 'formidable' ); ?></h2> |
| 48 |
<div> |
| 49 |
<?php |
| 50 |
FrmHtmlHelper::toggle( 'frm_testmode_disable_required_fields', 'frm_testmode[disable_required_fields]', $disabled_required_fields_toggle_args ); |
| 51 |
FrmHtmlHelper::toggle( 'frm_testmode_show_all_hidden_fields', 'frm_testmode[show_all_hidden_fields]', $show_all_hidden_fields_toggle_args ); |
| 52 |
|
| 53 |
if ( $roles ) : |
| 54 |
?> |
| 55 |
<label> |
| 56 |
<?php esc_html_e( 'Preview as', 'formidable' ); ?> |
| 57 |
|
| 58 |
<select id="frm_testmode_preview_role" name="frm_testmode[preview_role]" <?php disabled( ! $enabled ); ?>> |
| 59 |
<?php |
| 60 |
foreach ( $roles as $role => $details ) { |
| 61 |
FrmHtmlHelper::echo_dropdown_option( |
| 62 |
$details['name'], |
| 63 |
$selected_role === $role, |
| 64 |
array( |
| 65 |
'value' => $role, |
| 66 |
) |
| 67 |
); |
| 68 |
} |
| 69 |
?> |
| 70 |
</select> |
| 71 |
</label> |
| 72 |
<?php endif; ?> |
| 73 |
|
| 74 |
<label> |
| 75 |
<?php |
| 76 |
esc_html_e( 'Enabled form actions', 'formidable' ); |
| 77 |
FrmAppHelper::tooltip_icon( __( 'Selected form actions will be triggered when this test entry is submitted', 'formidable' ) ); |
| 78 |
?> |
| 79 |
<div id="frm_testmode_enabled_form_actions_container" class="frm-fields"> |
| 80 |
<select id="frm_testmode_enabled_form_actions" multiple class="frm_multiselect" name="frm_testmode[enabled_form_actions][]" <?php disabled( ! $enabled ); ?>> |
| 81 |
<?php |
| 82 |
foreach ( $form_actions as $form_action ) { |
| 83 |
?> |
| 84 |
<option value="<?php echo esc_attr( $form_action->ID ); ?>" <?php selected( in_array( $form_action->ID, $enabled_form_actions, true ), true ); ?>> |
| 85 |
<?php echo esc_html( $form_action->post_title ) . ' (' . absint( $form_action->ID ) . ')'; ?> |
| 86 |
</option> |
| 87 |
<?php |
| 88 |
} |
| 89 |
?> |
| 90 |
</select> |
| 91 |
</div> |
| 92 |
</label> |
| 93 |
</div> |
| 94 |
<hr> |
| 95 |
<div> |
| 96 |
<label id="frm_quick_jump_label"><?php esc_html_e( 'Quick jump to page:', 'formidable' ); ?></label> |
| 97 |
|
| 98 |
<?php |
| 99 |
if ( false !== $pagination && is_callable( $pagination ) ) { |
| 100 |
$pagination(); |
| 101 |
} elseif ( false === $pagination ) { |
| 102 |
include FrmAppHelper::plugin_path() . '/classes/views/test-mode/pagination-buttons.php'; |
| 103 |
} |
| 104 |
?> |
| 105 |
|
| 106 |
<a id="frm_testmode_fill_in_empty_form_fields" class="frm_button frm-button-primary <?php echo $enabled && $ai_enabled ? '' : 'frm_noallow'; ?>" href="#"> |
| 107 |
<?php esc_html_e( 'Fill empty fields with AI', 'formidable' ); ?> |
| 108 |
</a> |
| 109 |
</div> |
| 110 |
<?php |
| 111 |
$start_over_button_attrs = array( |
| 112 |
'id' => 'frm_testmode_start_over', |
| 113 |
'class' => 'frm_button frm-button-secondary frm_noallow', |
| 114 |
'href' => '#', |
| 115 |
); |
| 116 |
/** |
| 117 |
* @since 6.25 |
| 118 |
* |
| 119 |
* @param array $start_over_button_attrs |
| 120 |
*/ |
| 121 |
$start_over_button_attrs = apply_filters( 'frm_testmode_start_over_button_attrs', $start_over_button_attrs ); |
| 122 |
?> |
| 123 |
<a <?php FrmAppHelper::array_to_html_params( $start_over_button_attrs, true ); ?>> |
| 124 |
<img src="<?php echo esc_url( FrmAppHelper::plugin_url() ); ?>/images/reset.svg" alt="<?php esc_attr_e( 'Reset', 'formidable' ); ?>" /> |
| 125 |
<?php esc_html_e( 'Reset', 'formidable' ); ?> |
| 126 |
</a> |
| 127 |
<?php if ( ! empty( $should_show_upsell ) ) { ?> |
| 128 |
<a href="<?php echo esc_url( FrmAppHelper::admin_upgrade_link( 'test-mode' ) ); ?>" class="frm-gradient" id="frm_testmode_upgrade"> |
| 129 |
<?php FrmAppHelper::icon_by_class( 'frmfont frm_speaker_icon', array( 'aria-hidden' => 'true' ) ); ?> |
| 130 |
<?php esc_html_e( 'Unlock these powerful, time saving testing features by upgrading!', 'formidable' ); ?> |
| 131 |
</a> |
| 132 |
<?php } ?> |
| 133 |
</div> |
| 134 |
|