Skip to content

Forms 2 compatibility - #612

Draft
duncanmcclean wants to merge 4 commits into
5.xfrom
forms-2
Draft

Forms 2 compatibility#612
duncanmcclean wants to merge 4 commits into
5.xfrom
forms-2

Conversation

@duncanmcclean

@duncanmcclean duncanmcclean commented Aug 31, 2026

Copy link
Copy Markdown
Member

This pull request makes the Eloquent Driver compatible with Forms 2 (statamic/cms#15039).

Forms

  • Form fields are now stored under a fields key, rather than inside blueprints.
  • The emails key has been replaced by a connections key which also stores configs for other, non-email, integrations (eg. webhooks).
  • A new charts key is used to store the chart configuration on the Submissions Summary view (only available when Forms Pro is installed)

Without explicit support for these keys, they would be silently dropped on import and on every save. These keys are persisted in the settings JSON column. No schema changes are necessary.

Backwards compatibility

We've made an effort to preserve backwards compatibility:

  • Legacy email configs will be migrated to connections on the next save.
  • Forms without inline fields will fall back to their legacy blueprint and be converted to a fields array on the next save.

Submissions

The save() and delete() overrides on the driver's Submission class had drifted from core — they never dispatched SubmissionCreating, and missed Forms 2's DeleteTemporaryFiles dispatch on delete.

Since core has persisted submissions through the repository since v5, this PR removes the overrides and moves the model persistence into SubmissionRepository::save()/delete(), letting core drive the lifecycle. This PR also fixes a bug where SubmissionRepository::save() refreshed the submission instead of the model.

Commands

The statamic:eloquent:import-forms and statamic:eloquent:export-forms commands now round-trip fields, connections and charts, converting legacy email settings to an email connection on the way out.

duncanmcclean and others added 3 commits August 31, 2026 16:03
under forms 2, `fromModel()` and `makeModelFromContract()` only round-tripped
title, store, email, honeypot and data — silently dropping `fields`, non-email
`connections` and `charts` on import and on every save.

legacy rows still hydrate correctly: a settings `email` array is converted to
an email connection (matching core's `hydrate()`), and rows without `fields`
fall back to the legacy blueprint file, which is deleted on save like core.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MxmaTX9k5n3QpZVbkchKwF
the `save()` and `delete()` overrides on `Submission` had drifted from core —
they never dispatched `SubmissionCreating` and missed the `DeleteTemporaryFiles`
dispatch on delete. core has persisted through `FormSubmission::save()` since
v5.0, so the model work now lives in `SubmissionRepository` instead.

also fixes `SubmissionRepository::save()` refreshing the submission instead of
the model.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MxmaTX9k5n3QpZVbkchKwF
`ImportForms` already funnels through `makeModelFromContract()`, so it just
needed coverage. `ExportForms` now rebuilds file forms with their fields,
connections and charts, converting legacy `email` settings on the way out.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MxmaTX9k5n3QpZVbkchKwF
@duncanmcclean
duncanmcclean marked this pull request as draft August 31, 2026 15:05
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011L28dDrEH5JpkJiuXV9AC5
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