| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) { |
| 3 |
die( 'You are not allowed to call this page directly.' ); |
| 4 |
} |
| 5 |
?> |
| 6 |
|
| 7 |
<input type="hidden" name="<?php echo esc_attr( $action_control->get_field_name( 'post_excerpt', '' ) ); ?>" class="frm_action_name" value="<?php echo esc_attr( $form_action->post_excerpt ); ?>" /> |
| 8 |
<input type="hidden" name="<?php echo esc_attr( $action_control->get_field_name( 'ID', '' ) ); ?>" value="<?php echo esc_attr( $form_action->ID ); ?>" /> |
| 9 |
|
| 10 |
<?php |
| 11 |
/** |
| 12 |
* @since 6.25 |
| 13 |
* |
| 14 |
* @param WP_Post $form_action |
| 15 |
*/ |
| 16 |
do_action( 'frm_action_settings_before_action_name', $form_action ); |
| 17 |
?> |
| 18 |
|
| 19 |
<div class="frm_grid_container"> |
| 20 |
<p class="frm6 frm_form_field"> |
| 21 |
<label for="<?php echo esc_attr( $action_control->get_field_id( 'action_post_title' ) ); ?>"> |
| 22 |
<?php esc_html_e( 'Action Name', 'formidable' ); ?> |
| 23 |
<span <?php FrmAppHelper::maybe_add_tooltip( 'action_title' ); ?>><?php FrmAppHelper::icon_by_class( 'frmfont frm_tooltip_icon frm_svg14' ); ?></span> |
| 24 |
</label> |
| 25 |
<input type="text" name="<?php echo esc_attr( $action_control->get_field_name( 'post_title', '' ) ); ?>" value="<?php echo esc_attr( $form_action->post_title ); ?>" class="large-text" id="<?php echo esc_attr( $action_control->get_field_id( 'action_post_title' ) ); ?>" /> |
| 26 |
</p> |
| 27 |
<?php |
| 28 |
|
| 29 |
if ( ! isset( $action_control->action_options['event'] ) ) { |
| 30 |
$action_control->action_options['event'] = 'create'; |
| 31 |
} |
| 32 |
|
| 33 |
if ( ! is_array( $action_control->action_options['event'] ) ) { |
| 34 |
$action_control->action_options['event'] = explode( ',', $action_control->action_options['event'] ); |
| 35 |
} |
| 36 |
|
| 37 |
if ( count( $action_control->action_options['event'] ) === 1 || $action_control->action_options['force_event'] ) { |
| 38 |
foreach ( $action_control->action_options['event'] as $e ) { |
| 39 |
?> |
| 40 |
<input type="hidden" name="<?php echo esc_attr( $action_control->get_field_name( 'event' ) ); ?>[]" value="<?php echo esc_attr( $e ); ?>" /> |
| 41 |
<?php |
| 42 |
} |
| 43 |
} else { |
| 44 |
?> |
| 45 |
<p class="frm6 frm_form_field"> |
| 46 |
<label for="<?php echo esc_attr( $action_control->get_field_id( 'event' ) ); ?>"> |
| 47 |
<?php esc_html_e( 'Trigger this action when', 'formidable' ); ?> |
| 48 |
</label> |
| 49 |
<select name="<?php echo esc_attr( $action_control->get_field_name( 'event' ) ); ?>[]" multiple="multiple" class="frm_multiselect" id="<?php echo esc_attr( $action_control->get_field_id( 'event' ) ); ?>"> |
| 50 |
<?php |
| 51 |
|
| 52 |
$event_labels = FrmFormAction::trigger_labels(); |
| 53 |
|
| 54 |
foreach ( $action_control->action_options['event'] as $event ) { |
| 55 |
?> |
| 56 |
<option value="<?php echo esc_attr( $event ); ?>" <?php echo in_array( $event, (array) $form_action->post_content['event'], true ) ? ' selected="selected"' : ''; ?> ><?php echo esc_html( $event_labels[ $event ] ?? $event ); ?></option> |
| 57 |
<?php } ?> |
| 58 |
</select> |
| 59 |
</p> |
| 60 |
<?php |
| 61 |
}//end if |
| 62 |
|
| 63 |
?> |
| 64 |
</div> |
| 65 |
<?php |
| 66 |
$pass_args = array( |
| 67 |
'form' => $form, |
| 68 |
'action_control' => $action_control, |
| 69 |
'action_key' => $action_key, |
| 70 |
'values' => $values, |
| 71 |
); |
| 72 |
|
| 73 |
/** |
| 74 |
* Fires before form action settings. |
| 75 |
* |
| 76 |
* @since 6.10 |
| 77 |
* |
| 78 |
* @param object $form_action Form action object. |
| 79 |
* @param array $pass_args Pass args. |
| 80 |
*/ |
| 81 |
do_action( 'frm_before_action_settings', $form_action, $pass_args ); |
| 82 |
|
| 83 |
$action_control->form( $form_action, compact( 'form', 'action_key', 'values' ) ); |
| 84 |
|
| 85 |
do_action( 'frm_additional_action_settings', $form_action, $pass_args ); |
| 86 |
|
| 87 |
// Show Conditional logic indicator. |
| 88 |
if ( ! FrmAppHelper::pro_is_installed() ) { |
| 89 |
if ( 'email' === $form_action->post_excerpt ) { |
| 90 |
include FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/_email_attachment_upsell.php'; |
| 91 |
} |
| 92 |
|
| 93 |
$action_control->render_conditional_logic_call_to_action( $action_key ); |
| 94 |
} |
| 95 |
|
| 96 |
// Show Form Action Automation indicator. |
| 97 |
if ( ! function_exists( 'load_frm_autoresponder' ) && in_array( $form_action->post_excerpt, apply_filters( 'frm_autoresponder_allowed_actions', array( 'email', 'twilio', 'api', 'register' ) ), true ) ) { |
| 98 |
$upgrading = FrmAddonsController::install_link( 'autoresponder' ); |
| 99 |
$params = array( |
| 100 |
'class' => 'frm-h-stack-xs frm-bt-200 frm-py-md frm-mb-xs frm_show_upgrade', |
| 101 |
'data-upgrade' => __( 'Form action automations', 'formidable' ), |
| 102 |
'data-medium' => 'action-automation', |
| 103 |
'data-content' => 'automation', |
| 104 |
); |
| 105 |
|
| 106 |
if ( isset( $upgrading['url'] ) ) { |
| 107 |
$params['data-oneclick'] = json_encode( $upgrading ); |
| 108 |
} else { |
| 109 |
$params['data-requires'] = FrmFormsHelper::get_plan_required( $upgrading ); |
| 110 |
} |
| 111 |
?> |
| 112 |
<div <?php FrmAppHelper::array_to_html_params( $params, true ); ?>> |
| 113 |
<?php |
| 114 |
FrmHtmlHelper::toggle( |
| 115 |
'frm_autoresponder_cta_' . $action_key, |
| 116 |
'frm_autoresponder_cta_' . $action_key, |
| 117 |
array( |
| 118 |
'div_class' => 'with_frm_style frm_toggle', |
| 119 |
'checked' => false, |
| 120 |
'echo' => true, |
| 121 |
'disabled' => true, |
| 122 |
) |
| 123 |
); |
| 124 |
?> |
| 125 |
<label for="frm_autoresponder_cta_<?php echo esc_attr( $action_key ); ?>" class="frm_noallow"> |
| 126 |
<?php esc_html_e( 'Setup Automation', 'formidable' ); ?> |
| 127 |
</label> |
| 128 |
</div> |
| 129 |
<?php |
| 130 |
unset( $params ); |
| 131 |
}//end if |
| 132 |
|
| 133 |
// Show link to install logs. |
| 134 |
if ( $use_logging ) { |
| 135 |
$upgrading = FrmAddonsController::install_link( 'logs' ); |
| 136 |
|
| 137 |
if ( isset( $upgrading['url'] ) ) { |
| 138 |
?> |
| 139 |
<p> |
| 140 |
<a href="javascript:void(0)" class="frm_show_upgrade frm-h-stack-xs" data-upgrade="<?php esc_attr_e( 'Form action logs', 'formidable' ); ?>" data-medium="action-logs" data-content="logs" data-oneclick="<?php echo esc_attr( json_encode( $upgrading ) ); ?>"> |
| 141 |
<?php FrmAppHelper::icon_by_class( 'frmfont frm_tooltip_solid_icon', array( 'aria-hidden' => 'true' ) ); ?> |
| 142 |
<?php esc_html_e( 'Install logging to get more information on API requests.', 'formidable' ); ?> |
| 143 |
</a> |
| 144 |
</p> |
| 145 |
<?php |
| 146 |
} |
| 147 |
} |
| 148 |
?> |
| 149 |
<span class="alignright frm_action_id frm-sub-label <?php echo esc_attr( ! empty( $form_action->ID ) ? '' : 'frm_hidden' ); ?>"> |
| 150 |
<?php |
| 151 |
/* translators: %1$s: The ID of the form action. */ |
| 152 |
printf( esc_html__( 'Action ID: %1$s', 'formidable' ), esc_attr( $form_action->ID ) ); |
| 153 |
?> |
| 154 |
</span> |
| 155 |
<div style="clear:both;"></div> |
| 156 |
|