Skip to content

Rock: Virtual Field (Lite)#2846

Merged
Crabcyborg merged 38 commits into
masterfrom
rock/virtual-field
Mar 10, 2026
Merged

Rock: Virtual Field (Lite)#2846
Crabcyborg merged 38 commits into
masterfrom
rock/virtual-field

Conversation

@shervElmi

@shervElmi shervElmi commented Jan 20, 2026

Copy link
Copy Markdown
Contributor

Pro PR


Handoff

https://linear.app/strategy11/document/handoff-0819be205304

Screen recording demo

https://share.cleanshot.com/NL9qnGkq

Summary by CodeRabbit

  • New Features

    • Added a new "Virtual" Pro field option for expanded form-building.
  • Performance

    • Skips unnecessary processing for empty values to reduce overhead.
  • Chores

    • Made entry helper functionality more accessible to enable greater extensibility and integrations.

@shervElmi shervElmi self-assigned this Jan 20, 2026
@coderabbitai

coderabbitai Bot commented Jan 20, 2026

Copy link
Copy Markdown
Contributor

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds a new Pro field entry 'virtual' to FrmField::pro_field_selection(), adds an early-return guard for empty input in FrmAppHelper::strip_most_html(), and changes FrmEntriesHelper::get_posted_meta() visibility from private static to public static.

Changes

Cohort / File(s) Summary
Pro Field Addition
classes/models/FrmField.php
Inserted a new 'virtual' entry into the pro_field_selection() return array with keys: name, icon, message, upsell_image, and learn-more.
Input Guard
classes/helpers/FrmAppHelper.php
Added an early-return in strip_most_html() to immediately return when the input is an empty string (''), avoiding further sanitization steps.
Visibility Change
classes/helpers/FrmEntriesHelper.php
Changed get_posted_meta() visibility from private static to public static; parameters and implementation unchanged.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I found a tiny virtual light,

tucked in arrays and tucked in sight.
I skip the empty, hop to the core,
and now the helper opens the door.
A public wink, a field to explore.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Rock: Virtual Field (Lite)' clearly summarizes the main change—adding virtual field support to the Lite version of Formidable Forms, which is reflected in the Pro field entry addition and related changes across three files.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch rock/virtual-field

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


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

Comment @coderabbitai help to get the list of available commands and usage tips.

@shervElmi shervElmi changed the title Rock: Virtual Field Rock: Virtual Field (Lite) Jan 21, 2026
@deepsource-io

deepsource-io Bot commented Feb 9, 2026

Copy link
Copy Markdown

DeepSource Code Review

We reviewed changes in 745b145...8575ff3 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  

Focus Area: Security
Security  

Reliability  

Complexity  

Hygiene  

Feedback

  • No centralized input sanitization
    • An unused sanitizer suggests validation was designed but not applied; the include path is built from unchecked data and reuses that gap. Consolidate sanitization/whitelisting into one entry point that every file/path input must pass.
  • Dynamic file loading without a safe wrapper
    • Includes are performed directly on variable data while helper logic sits idle, so risky patterns repeat. Encapsulate all include/load operations in a vetted helper that enforces canonical paths and a strict whitelist.
  • Accumulated dead helpers obscure intent
    • Private helpers left unused indicate feature drift: safety contracts live in abandoned code while unsafe code persists. Remove or reinstate those helpers and expose a small, well-documented API so intent survives maintenance.

Code Review Summary

Analyzer Status Updated (UTC) Details
PHP Mar 10, 2026 1:48p.m. Review ↗
JavaScript Mar 10, 2026 1:48p.m. Review ↗

@shervElmi
shervElmi marked this pull request as ready for review February 9, 2026 17:32
@shervElmi
shervElmi requested a review from Crabcyborg February 9, 2026 17:34

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@classes/models/FrmField.php`:
- Around line 305-311: The 'virtual' field entry in FrmField.php has an
inconsistent leading slash in the 'learn-more' value which will produce a bad
URL when concatenated; update the 'virtual' => [...] array's 'learn-more' value
to remove the leading slash (change '/virtual' to 'virtual') so it matches other
entries and generates correct relative URLs for links.

Comment thread classes/models/FrmField.php
@codecov

codecov Bot commented Feb 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 26.68%. Comparing base (ddeaca4) to head (0a26cec).
⚠️ Report is 89 commits behind head on master.

Files with missing lines Patch % Lines
classes/helpers/FrmAppHelper.php 50.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #2846      +/-   ##
============================================
+ Coverage     26.60%   26.68%   +0.07%     
- Complexity     8867     8883      +16     
============================================
  Files           145      145              
  Lines         29822    29939     +117     
============================================
+ Hits           7934     7989      +55     
- Misses        21888    21950      +62     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@shervElmi shervElmi added the deploy Deploy website on push label Feb 18, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
classes/helpers/FrmEntriesHelper.php (1)

452-467: Consider documenting the unsanitized return value now that the method is public.

The implementation is intentionally unsanitized (callers are responsible for sanitizing, as both internal call-sites already do). While that contract was implicit and risk-free when the method was private, promoting it to public widens the API surface to any external caller (e.g., the Pro plugin). Without a docblock note, a new caller could easily forget to sanitize.

✏️ Suggested docblock update
 /**
  * `@since` 4.02.04
  *
  * `@param` int|string $field_id Field ID.
  * `@param` array      $args     Additional arguments.
  *
- * `@return` mixed
+ * `@return` mixed Raw, unsanitized value from $_POST. Callers must sanitize before use.
  */
 public static function get_posted_meta( $field_id, $args ) {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@classes/helpers/FrmEntriesHelper.php` around lines 452 - 467, Update the
public method get_posted_meta to document that it returns unsanitized input
pulled directly from $_POST and that callers (including external users) are
responsible for validation/sanitization; update the docblock above
get_posted_meta to explicitly state the contract (e.g., mention that returned
value may be raw/untrusted, callers must sanitize/validate), include `@param` tags
for $field_id and $args if missing, and make sure `@return` describes the mixed
raw data type and the `@since` tag remains accurate.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@classes/helpers/FrmEntriesHelper.php`:
- Around line 452-467: Update the public method get_posted_meta to document that
it returns unsanitized input pulled directly from $_POST and that callers
(including external users) are responsible for validation/sanitization; update
the docblock above get_posted_meta to explicitly state the contract (e.g.,
mention that returned value may be raw/untrusted, callers must
sanitize/validate), include `@param` tags for $field_id and $args if missing, and
make sure `@return` describes the mixed raw data type and the `@since` tag remains
accurate.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@classes/models/FrmField.php`:
- Line 310: The 'learn-more' array value in FrmField.php includes an
inconsistent leading slash ('/virtual'); update the array entry for the
'learn-more' key to remove the leading slash so it matches the other entries
(i.e., change '/virtual' to 'virtual') in the same array inside the FrmField
class or method that defines these URL fragments.

Comment thread classes/helpers/FrmEntriesHelper.php
@Crabcyborg Crabcyborg added this to the 6.29 milestone Mar 6, 2026

@Crabcyborg Crabcyborg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @shervElmi!

I'll go ahead and merge this.

🚀

shervElmi and others added 19 commits March 6, 2026 21:23
@shervElmi

shervElmi commented Mar 9, 2026

Copy link
Copy Markdown
Contributor Author

@Crabcyborg I've added the new Update Modal feature, and it works for the virtual field as shown in the GIF below:

CleanShot 2026-03-10 at 14 33 59

@Crabcyborg Crabcyborg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you @shervElmi!

I think we're actually good to merge this now.

🚀

@Crabcyborg
Crabcyborg merged commit 624eac8 into master Mar 10, 2026
21 of 22 checks passed
@Crabcyborg
Crabcyborg deleted the rock/virtual-field branch March 10, 2026 17:19
stephywells pushed a commit that referenced this pull request Apr 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants