Handles the action for a specific form submission.
Description
See also
Parameters
- $submission
-
(awsmug\Torro_Forms\DB_Objects\Submissions\Submission) (Required) Submission to handle by the action.
- $form
-
(awsmug\Torro_Forms\DB_Objects\Forms\Form) (Required) Form the submission applies to.
Return
(bool|WP_Error) True on success, error object on failure.
Source
File: src/modules/actions/redirection.php
public function handle( $submission, $form ) { $redirect_type = $this->get_form_option( $form->id, 'type', 'redirect_none' ); $redirect_url = ''; switch ( $redirect_type ) { case 'redirect_url': $redirect_url = $this->get_form_option( $form->id, 'url' ); break; case 'redirect_page': $redirect_page = (int) $this->get_form_option( $form->id, 'page' ); if ( ! empty( $redirect_page ) ) { $redirect_url = get_permalink( $redirect_page ); } } if ( ! empty( $redirect_url ) ) { add_filter( "{$this->module->get_prefix()}handle_form_submission_redirect_url", function() use ( $redirect_url ) { return $redirect_url; }, 100, 0 ); } return true; }
Changelog
Version | Description |
---|---|
1.0.0 | Introduced. |