-
Notifications
You must be signed in to change notification settings - Fork 41
Add redirect delay settings #2117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
0cc46b3
Add redirect delay settings
truongwp 4fdc177
Apply new settings
truongwp 2817973
Fix delay redirect with AJAX submit
truongwp 0bbb4fc
Fix delay redirect
truongwp f936a10
Fix duplicate redirect message
truongwp df10556
Do not allow negative redirect delay time
truongwp d8d24aa
Fix phpcs
truongwp 70110dd
Fix PHPUnit
truongwp 2ceacc5
Fix phpcs
truongwp 1483241
Fix phpcs and phpunit
truongwp c7a5a27
Merge branch 'master' into redirect-delay-settings
truongwp b9d7719
Fix redirect delay message editor doesn't work
truongwp 7cd99c2
Improve redirect delay styling
truongwp 4d36335
Make shortcodes work in redirect delay message
truongwp 88706fe
Add a notice to fallback confirmation action
truongwp 1d8de8a
Fix PHPCS
truongwp 2094ba7
Update the fallback action notice styling
truongwp 21b9bea
Remove excess semicolon
truongwp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
121 changes: 121 additions & 0 deletions
121
classes/views/frm-form-actions/on_submit_redirect_settings.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,121 @@ | ||
| <?php | ||
| /** | ||
| * On Submit redirect settings | ||
| * | ||
| * @package Formidable | ||
| * @since x.x | ||
| * | ||
| * @var array $args See {@see FrmOnSubmitHelper::show_redirect_settings()}. | ||
| */ | ||
|
|
||
| if ( ! defined( 'ABSPATH' ) ) { | ||
| die( 'You are not allowed to call this page directly.' ); | ||
| } | ||
|
|
||
| $id_attr = $args['action_control']->get_field_id( 'success_url' ); | ||
| ?> | ||
| <div class="frm_form_field frm_has_shortcodes"> | ||
| <label for="<?php echo esc_attr( $id_attr ); ?>"><?php esc_html_e( 'Redirect URL', 'formidable' ); ?></label> | ||
| <input | ||
| type="text" | ||
| id="<?php echo esc_attr( $id_attr ); ?>" | ||
| name="<?php echo esc_attr( $args['action_control']->get_field_name( 'success_url' ) ); ?>" | ||
| value="<?php echo esc_attr( $args['form_action']->post_content['success_url'] ); ?>" | ||
| /> | ||
| </div> | ||
|
|
||
| <?php | ||
| $id_attr = $args['action_control']->get_field_id( 'open_in_new_tab' ); | ||
| $name_attr = $args['action_control']->get_field_name( 'open_in_new_tab' ); | ||
| ?> | ||
| <div class="frm_form_field"> | ||
| <?php | ||
| FrmHtmlHelper::toggle( | ||
| $id_attr, | ||
| $name_attr, | ||
| array( | ||
| 'div_class' => 'with_frm_style frm_toggle', | ||
| 'checked' => ! empty( $args['form_action']->post_content['open_in_new_tab'] ), | ||
| 'echo' => true, | ||
| ) | ||
| ); | ||
| ?> | ||
| <label for="<?php echo esc_attr( $id_attr ); ?>" <?php FrmAppHelper::maybe_add_tooltip( 'new_tab' ); ?>> | ||
| <?php esc_html_e( 'Open in new tab', 'formidable' ); ?> | ||
| </label> | ||
| </div> | ||
|
|
||
| <?php | ||
| $id_attr = $args['action_control']->get_field_id( 'redirect_delay' ); | ||
| $redirect_delay = ! empty( $args['form_action']->post_content['redirect_delay'] ); | ||
| ?> | ||
| <div class="frm_form_field"> | ||
| <?php | ||
| FrmHtmlHelper::toggle( | ||
| $id_attr, | ||
| $args['action_control']->get_field_name( 'redirect_delay' ), | ||
| array( | ||
| 'div_class' => 'with_frm_style frm_toggle', | ||
| 'checked' => $redirect_delay, | ||
| 'echo' => true, | ||
| 'input_html' => array( | ||
| 'data-toggleclass' => 'frm_redirect_delay_settings', | ||
| ), | ||
| ) | ||
| ); | ||
| ?> | ||
| <label for="<?php echo esc_attr( $id_attr ); ?>"> | ||
| <?php esc_html_e( 'Delay redirect and show message', 'formidable' ); ?> | ||
| </label> | ||
| </div> | ||
|
|
||
| <?php | ||
| $css_class = 'frm_redirect_delay_settings'; | ||
| if ( ! $redirect_delay ) { | ||
| $css_class .= ' frm_hidden'; | ||
| } | ||
| ?> | ||
| <div class="<?php echo esc_attr( $css_class ); ?>"> | ||
| <?php | ||
| $id_attr = $args['action_control']->get_field_id( 'redirect_delay_time' ); | ||
| $delay_time = intval( $args['form_action']->post_content['redirect_delay_time'] ); | ||
| if ( $delay_time < 1 ) { | ||
| $delay_time = 8; | ||
| } | ||
| ?> | ||
| <div class="frm_form_field"> | ||
| <label for="<?php echo esc_attr( $id_attr ); ?>"><?php esc_html_e( 'Delay time', 'formidable' ); ?></label> | ||
| <span class="frm_input_with_suffix"> | ||
| <input | ||
| type="number" | ||
| min="1" | ||
| step="1" | ||
| id="<?php echo esc_attr( $id_attr ); ?>" | ||
| name="<?php echo esc_attr( $args['action_control']->get_field_name( 'redirect_delay_time' ) ); ?>" | ||
| value="<?php echo intval( $delay_time ); ?>" | ||
| style="width:60px;" | ||
| /><span class="frm_suffix"><?php esc_html_e( 'seconds', 'formidable' ); ?></span> | ||
| </span> | ||
| </div> | ||
|
|
||
| <?php | ||
| $id_attr = $args['action_control']->get_field_id( 'redirect_delay_msg' ); | ||
| ?> | ||
| <div class="frm_form_field frm_has_shortcodes"> | ||
| <label for="<?php echo esc_attr( $id_attr ); ?>" class="screen-reader-text"> | ||
| <?php esc_html_e( 'Redirect message', 'formidable' ); ?> | ||
| </label> | ||
|
|
||
| <?php | ||
| wp_editor( | ||
| $args['form_action']->post_content['redirect_delay_msg'], | ||
| $id_attr, | ||
| array( | ||
| 'textarea_name' => $args['action_control']->get_field_name( 'redirect_delay_msg' ), | ||
| 'textarea_rows' => 4, | ||
| 'editor_class' => 'frm_not_email_message', | ||
| ) | ||
| ); | ||
| ?> | ||
| </div> | ||
| </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.