Skip to content

Add hooks to show a View in the Confirmation action - #3651

Draft
Crabcyborg wants to merge 7 commits into
masterfrom
feat/confirmation-page-output-hooks
Draft

Crabcyborg wants to merge 7 commits into
masterfrom
feat/confirmation-page-output-hooks

Conversation

@Crabcyborg

Copy link
Copy Markdown
Contributor

Adds the Lite hooks Formidable Views needs to offer a View as a Confirmation action option, next to page content. All of the View logic lives in Views. Lite only gets two filters and one new arg.

Changes

  • frm_on_submit_types filter in on_submit_settings.php. Add-ons can change the label and settings callback of the Confirmation types. Views uses it to relabel the page type "Show Page or View" and add a Page/View choice with a View picker.
  • frm_on_submit_page_output filter in FrmFormsController::load_page_after_submit(). When a callback returns a string, it is shown instead of the page content. Views uses it when the selected post is a View.
  • $args['on_submit_action'] is now set in the single-action path of run_on_submit_actions() and in get_run_success_action_args(), so the output filter knows which Confirmation action is running. Views uses it to show the submitted entry, or the View listing, based on an action setting.

Without Views active, nothing changes. Both filters default to the current behavior.

Testing

Tested with the companion Views change, which stores the View ID in the existing success_page_id setting.

  1. Edit a form's Confirmation action. The third type reads "Show Page or View". Pick View, choose a View, set Show to "The submitted entry", and save.
  2. Submit the form, both normal and ajax. A dynamic View shows its detail page for the new entry, and a list View shows only the new entry. With Show set to "The View listing", the normal listing shows.
  3. Two matching Confirmation actions (a message plus a View) both render. This covers get_run_success_action_args().
  4. Regression: Show Page Content with a normal page, Show Message, and Redirect to URL all behave as before.
  5. With Views deactivated, the Confirmation settings and output are unchanged.

Review notes

  • echo $output in load_page_after_submit() carries a phpcs:ignore for OutputNotEscaped, matching how the method already echoes the_content output. Please confirm this is acceptable.

🤖 Generated with Claude Code

Add the frm_on_submit_types filter so add-ons can change the
Confirmation action types and their settings, and the
frm_on_submit_page_output filter so they can replace the output of
the page type. Pass the running Confirmation action to
run_success_action() as on_submit_action so that output can depend
on the action's settings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@deepsource-io

deepsource-io Bot commented Nov 2, 2026

Copy link
Copy Markdown

DeepSource Code Review

We reviewed changes in ff302be...c7761c5 on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

Code Review Summary

Analyzer Status Updated (UTC) Details
PHP Nov 2, 2026 5:37p.m. Review ↗
JavaScript Nov 2, 2026 5:37p.m. Review ↗

Important

AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.

* @param WP_Post $page The selected post.
* @param array $args See {@see FrmFormsController::run_success_action()}.
*/
$output = apply_filters( 'frm_on_submit_page_output', null, $page, $args );

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function apply_filters invoked with 4 parameters, 2 required


The function call is not valid, which will result in a fatal runtime error.

* @param object $instance Form action post object.
* @param array $args Contains `form`, `action_key`, `values`.
*/
$types = apply_filters( 'frm_on_submit_types', $types, $instance, $args );

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function apply_filters invoked with 4 parameters, 2 required


The function call is not valid, which will result in a fatal runtime error.

@deepsource-io

deepsource-io Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

DeepSource Code Review

We reviewed changes in 85479d8...4386350 on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

Important

Some issues found as part of this review are outside of the diff in this pull request and aren't shown in the inline review comments due to GitHub's API limitations. You can see those issues on the DeepSource dashboard.

PR Report Card

Overall Grade   Security  

Reliability  

Complexity  

Hygiene  

Code Review Summary

Analyzer Status Updated (UTC) Details
PHP Dec 2, 2026 1:44p.m. Review ↗
JavaScript Dec 2, 2026 1:44p.m. Review ↗

Important

AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant