Skip to content

docs(2.x): panel form slices (specs 0086, 0088) - #57

Open
glennjacobs wants to merge 4 commits into
nextfrom
docs/panel-draft-slices
Open

glennjacobs wants to merge 4 commits into
nextfrom
docs/panel-draft-slices

Conversation

@glennjacobs

@glennjacobs glennjacobs commented Sep 16, 2026

Copy link
Copy Markdown
Collaborator

Summary

Partner PR to lunarphp/lunar#2741 (spec 0086, the FormSlice / DraftSlice contracts on the drafted edit pages) and lunarphp/lunar#2742 (spec 0088, the same slices on the create pages and settings forms). Should merge after both land on 2.x.

  • New page 2.x/admin/extending/form-slices.mdx: the panel's stance on extending first-party forms (add-ons add fields under a namespace they own, on any form's save, and never touch the form's own fields), the {namespace}:{field} and addon:{key}:{field} key schemes, registration through Section::formExtensions() and what registration rejects, the FormSlice contract with a method table and DraftSlice for draft-only state, the LoyaltyTierSlice worked example, useFormSlice and its return shape, what differs between drafted edit pages and plain create or settings forms, the shared formSliceValues prop with useEditDraft and usePanelForm, the first-party slices on the product page, and stale-key handling.
  • Edit Drafts: a pointer section for adding to a first-party form, plus dirtyKeys and the slice seeding note on the JS side.
  • Slots: the example section snippet now matches the source (the loyalty card on both customer pages), the SEO note points at slices for persistence, and a see-also link.
  • Overview: formSlices() and formExtensions() in the hook table.
  • Building an add-on: the entry-point snippet registers LoyaltyCard as the source does.
  • CLAUDE.md: the branch workflow now reflects that the former 2.x branch merged into next.
  • docs.json: the new page sits after Edit Drafts in the Admin Panel → Extending group.

Every class, method, prop, and composable name was checked against the two implementation branches. mint broken-links passes.

🤖 Generated with Claude Code

glennjacobs and others added 2 commits September 16, 2026 11:26
Adds the Draft Slices page for add-on authors: the add-ons-add rule, the
`addon:{key}` key scheme, registration through draftExtensions(), the
DraftSlice contract with the loyalty tier worked example, the useDraftSlice
return shape, what the slice gets for free, the draftSliceValues prop, and the
first-party slices on the product page. Cross-links the edit drafts, slots,
overview and add-on pages and keeps their example snippets in step with the
example add-on.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Follows the contract split and rename on lunar#2741 and the plain-form
composition on lunar#2742: the page is now Form Slices, documents the
FormSlice / DraftSlice contracts, formExtensions(), useFormSlice and
usePanelForm, and the differences between drafted edit pages and plain
create or settings forms.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@glennjacobs glennjacobs changed the title docs(2.x): panel draft slices (spec 0086) docs(2.x): panel form slices (specs 0086, 0088) Sep 16, 2026
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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