You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support repeater paths inside embedded forms - #3602
Support repeater fields inside embedded forms by preserving the full nested item_meta path when reading submitted values, checking whether values were posted, and writing validated values. Resolve nested frontend field IDs, including Other inputs and combo subfields, while ignoring form and row metadata.
Add FrmEntryMetaPathHelper and regression tests for nested reads and writes, malformed paths, sibling-row preservation, backslashes, and legacy parent arguments. The generated frontend script matches a fresh build. These are the existing local changes, separated without behavior changes.
Lite PHPUnit: 947 tests, 4,845 assertions, no failures. The runner reports 3 skipped tests, 3 incomplete tests, 99 notices, and one configuration deprecation.
Companion Pro branch: 13 embedded repeater tests with 42 assertions pass. Its AJAX regression passes separately with 4 assertions. The harness verifies that it loads the companion branch.
Source and generated JavaScript each pass 13 field ID checks. The generated file matches Closure Compiler output.
PHP syntax, PHPCS, PHP-CS-Fixer, Rector, scoped Mago lint, full-plugin PHPStan, Oxlint, typos, and whitespace checks pass. ESLint exits successfully with four warnings on unchanged lines. Full-plugin Mago analysis exits successfully with two warnings outside this change.
Full-plugin Psalm reports four errors. An isolated checkout of unchanged master reports the same four errors, concerning WordPress stubs and an existing deprecated function.
Reviewed the changed submission paths and frontend handling. No new security concern was identified.
Remaining verification
Keep this draft alongside the Pro draft until browser verification covers adding and removing nested rows, required validation, conditional logic, Other choices, totals, page navigation, and saved-entry editing. Browser verification was not run in this session.
We reviewed changes in 85479d8...9f6bb2a on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.
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.
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.
The reason will be displayed to describe this comment to others. Learn more.
Approve, with two non-blocking notes below.
Live before/after (preview env, Lite + Pro companion #6881 loaded; same seeded form: parent form → embedded form → repeater with a required text field):
Base (master Lite + master Pro): the embedded repeater's input renders as item_meta[7][0][6], outside the embed's item_meta[8][0]... path. A submit with the field filled saved the repeater rows as a top-level 7 meta on the parent entry instead of under the embed. A direct FrmEntryValidate::validate call with the correctly nested payload returned a false REQUIRED_MSG for a filled field and created a phantom item_meta[7] key.
PR (#3602 + #6881): input renders as item_meta[8][0][7][0][6]. Empty submit shows the required error on the right field (frm_field_6-7-0_container, screenshot below). Filled submit saves with no error, and the entry chain nests correctly (parent field 8 → embed entry → repeater entry → hello). Validate with the filled nested payload returns no errors and no phantom key; the empty payload errors only on the empty row.
Backslash loss in a sibling row (A \ B → A B) happens identically on base, so it is not a regression from this PR.
Not exercised: add/remove rows, conditional logic, Other choices, combo subfields, totals, page navigation, editing a saved entry, multiple rows through the browser. The new JS branch was only hit for a plain text field. Run only against the PR's own two-PR pairing: Lite alone changes nothing (nothing in Lite sets item_meta_path), and Pro #6881 needs this Lite helper, so this should merge first. CI is all skipping because the PR is a draft, so PHPUnit/PHPCS/PHPStan have not run on GitHub; I read the diff and the source but did not run the PHPUnit file or the lint tools myself.
The reason will be displayed to describe this comment to others. Learn more.
Non-blocking: the early return at line 535 (if ( ! $args['parent_field_id'] ) { return; }, not in this diff) is the legacy argument, but the lines below it are now path-aware. A caller that passes only item_meta_path (the way Pro's new code calls get_posted_meta) hits an undefined-index notice here, and with parent_field_id empty it returns before the path is ever used. Pro #6881 happens to pass both today. Make that guard match the path logic so the two can't drift: if ( empty( $args['parent_field_id'] ) && empty( $args['item_meta_path'] ) ) { return; }.
The "Other" branch also has no test; test_FrmEntryMetaPathHelper covers read/write/malformed/legacy but not set_other_repeating_vals with a path. A short case with $_POST['item_meta'][10][0]['other'][30] would cover it.
The reason will be displayed to describe this comment to others. Learn more.
Non-blocking: path is a new option on a widely used function, but it isn't in $defaults or the docblock, and FrmEntryMetaPathHelper::get_posted_row() is its only caller. Either add 'path' => array() to $defaults and document it, or keep the walk inside FrmEntryMetaPathHelper so get_simple_request stays as it was. The existing contract (wp_unslash after the lookup) is preserved either way.
Move the item_meta path walk out of FrmAppHelper::get_simple_request()
so its options stay unchanged. Let set_other_repeating_vals() accept a
caller that passes only item_meta_path, and cover the nested Other value
with a test.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The reason will be displayed to describe this comment to others. Learn more.
Approve, with one non-blocking note. Re-review of the whole PR at 70fa31b (my Approve was at dcc4e06). Since then: two master merges and b71c8d6, which moves the path walk out of get_simple_request() into FrmEntryMetaPathHelper::get_posted_row() and makes set_other_repeating_vals() path-aware. That closes both notes from my last round.
Live before/after (fresh preview env, Lite #3602 at 70fa31b + Pro #6881 at fe6a48f vs. both merge-bases; parent form -> embedded form -> repeater with a required text field):
Base: the repeater input renders as item_meta[10][0][11], outside the embed path item_meta[12][0]. A filled submit saves a raw serialized array on the parent entry (field 10 = a:3:{form,row_ids,0 => [ '', 11 => 'hello' ]}) and creates no embed or row entries.
PR: input renders as item_meta[12][0][10][0][11]. Empty submit shows "Item cannot be blank." on frm_field_11-10-0_container (the right nested field). Filled submit saves with no error, and the entry chain nests: parent entry 5 -> embed entry 4 (form 5) -> row entry 3 (form 6) with field 11 = hello.
Tests run:vendor/bin/phpunit tests/phpunit/entries/test_FrmEntryMetaPathHelper.php at 70fa31b in the wordpress-develop harness -> OK (4 tests, 11 assertions). tests/phpunit/entries OK (51 tests, 295 assertions); test_FrmAppHelper.php OK (32 tests, 147 assertions). With the new empty( $args['item_meta_path'] ) guard term removed from set_other_repeating_vals(), the new Other-value test errors; restored, it passes. CI is all skipping (draft), so PHPUnit/PHPCS/PHPStan did not run on GitHub. I did not run PHPCS/PHPStan; php -l is clean on both PHP files.
Not exercised: add/remove rows in the browser, conditional logic, Other and combo fields live (Other is covered by the unit test only), totals, page navigation, editing a saved entry. The server-side required message came back on the correct container, but I did not isolate whether the new getFieldId JS branch ran (the preview env can serve a stale formidable.min.js); the min file does contain the new matcher and differs from master only by Closure reflow plus this change. code-review/security-review/simplify were not run; I read the diff directly. No new security surface: values are still unslashed once and sanitized downstream, and the path is only used as array keys.
FrmEntriesHelper.php:540: get_posted_row() now runs for every non-empty field in a repeater, before the cheap other option check (non-blocking, inline).
The reason will be displayed to describe this comment to others. Learn more.
Non-blocking efficiency note. maybe_set_other_validation() calls this for every non-empty field in a repeater row, and get_posted_row() runs wp_unslash() over the whole $_POST['item_meta'] each time (via get_simple_request()). Before this PR the legacy repeater path was a single isset() on item_meta[parent][pointer]['other'][field]. With a big repeater that is one full-array map_deep per field per row. The row only matters when the field has the other option, so check that first and read the row after:
The reason will be displayed to describe this comment to others. Learn more.
Approve. Re-review of the whole PR at 8a0bdff (my last Approve was at 70fa31b). The only change since is 8a0bdff: set_other_repeating_vals() now checks the cheap other option first, before get_posted_row(). That closes my one non-blocking note, and the logic is otherwise identical.
Live before/after (fresh preview env, Lite #3602 at 8a0bdff + Pro #6881 at fe6a48f vs. both merge-bases 7f27c411a / 40663bd51; parent form -> embedded form -> repeater with a required text field):
Base: the repeater input renders as item_meta[6][0][7], outside the embed path item_meta[8][0]. A filled submit saves the parent entry with field 6 = raw serialized array (a:3:{form, row_ids, 0 => [ '', 7 => 'hello' ]}) and creates no embed or row entries.
PR: the input renders as item_meta[8][0][6][0][7]. Empty submit shows "Item cannot be blank." with the error link pointing at #frm_field_7-6-0_container (the right nested field). Filled submit succeeds, and the chain nests: parent entry 3 (form 4) -> embed entry 2 (form 2) -> row entry 1 (form 3) with field 7 = hello.
Tests run:vendor/bin/phpunit tests/phpunit/entries/test_FrmEntryMetaPathHelper.php at 8a0bdff in the wordpress-develop harness -> OK (4 tests, 11 assertions). tests/phpunit/entries -> OK (51 tests, 295 assertions). With the other guard term removed from set_other_repeating_vals(), the new Other-value test errors (Undefined array key "other"); restored, it passes. php -l is clean on both PHP files. CI is all skipping (draft), so PHPUnit/PHPCS/PHPStan did not run on GitHub, and I did not run PHPCS/PHPStan.
Not exercised: add/remove rows in the browser, conditional logic, Other and combo fields live (Other is covered by the unit test only), totals, page navigation, editing a saved entry, and the new getFieldId JS branch in the browser (the live check was a server-side submit). Pairing note: Lite alone changes nothing, and Pro #6881 needs this Lite helper, so this should merge first. code-review/security-review/simplify were not run; I read the full diff directly. No new security surface: values are read from $_POST through get_simple_request, and the path is only used as array keys.
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
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.
Support repeater fields inside embedded forms by preserving the full nested
item_metapath when reading submitted values, checking whether values were posted, and writing validated values. Resolve nested frontend field IDs, including Other inputs and combo subfields, while ignoring form and row metadata.Add
FrmEntryMetaPathHelperand regression tests for nested reads and writes, malformed paths, sibling-row preservation, backslashes, and legacy parent arguments. The generated frontend script matches a fresh build. These are the existing local changes, separated without behavior changes.This is the Lite companion to https://github.com/Strategy11/formidable-pro/pull/6881. The field lifecycle hooks for the parent/child relations index remain separate in #3595.
Validation
Remaining verification
Keep this draft alongside the Pro draft until browser verification covers adding and removing nested rows, required validation, conditional logic, Other choices, totals, page navigation, and saved-entry editing. Browser verification was not run in this session.