Documentation
¶
Overview ¶
Package formbuilder contributes Payload-familiar dynamic form definitions, submission persistence, validation, payment callbacks, and email delivery.
Index ¶
- Constants
- func GetPaymentTotal(basePrice float64, conditions []PriceCondition, values map[string]store.Value) (float64, error)
- type BeforeEmail
- type CollectionOverride
- type Config
- type Email
- type EmailContext
- type FieldType
- type FieldsOverride
- type HandlePayment
- type PaymentContext
- type Plugin
- type PriceCondition
- type SendEmail
Constants ¶
const ( // Key is the stable backend/admin plugin identity. Key = "form-builder" // AdminPluginPairingVersion changes when the Go and TypeScript packages no // longer understand the same generated form contract. AdminPluginPairingVersion = 1 // DefaultFormsSlug is the collection containing reusable form definitions. DefaultFormsSlug schema.CollectionSlug = "forms" // DefaultSubmissionsSlug is the collection containing captured responses. DefaultSubmissionsSlug schema.CollectionSlug = "form-submissions" )
Variables ¶
This section is empty.
Functions ¶
func GetPaymentTotal ¶
func GetPaymentTotal(basePrice float64, conditions []PriceCondition, values map[string]store.Value) (float64, error)
GetPaymentTotal applies conditions in order, matching Payload's form-builder price model while rejecting non-finite arithmetic and division by zero.
Types ¶
type BeforeEmail ¶
type BeforeEmail func(EmailContext, []Email) ([]Email, error)
BeforeEmail can wrap templates, filter recipients, or otherwise transform the complete detached email batch before delivery.
type CollectionOverride ¶
type CollectionOverride func(defaultCollection ridu.Collection) (ridu.Collection, error)
CollectionOverride receives a detached generated collection and returns its complete replacement. The plugin reasserts lifecycle invariants afterward.
type Config ¶
type Config struct {
FormsSlug schema.CollectionSlug
SubmissionsSlug schema.CollectionSlug
EnabledFields []FieldType
UploadCollections []schema.CollectionSlug
RedirectRelationships []schema.CollectionSlug
PaymentProcessors []field.Choice
Fields FieldsOverride
Forms CollectionOverride
Submissions CollectionOverride
DefaultToEmail string
BeforeEmail BeforeEmail
SendEmail SendEmail
HandlePayment HandlePayment
ReportError func(error, string)
}
Config customizes the generated collections and executable form lifecycle.
type Email ¶
type Email struct {
To string
CC string
BCC string
From string
ReplyTo string
Subject string
HTML string
}
Email is one fully formatted outbound message. Delivery remains application owned so provider credentials never enter the plugin manifest or documents.
type EmailContext ¶
EmailContext identifies the committed submission that produced messages.
type FieldType ¶
type FieldType string
FieldType identifies one dynamic input block available to editors.
const ( FieldCheckbox FieldType = "checkbox" FieldCountry FieldType = "country" FieldDate FieldType = "date" FieldEmail FieldType = "email" FieldMessage FieldType = "message" FieldNumber FieldType = "number" FieldPayment FieldType = "payment" FieldRadio FieldType = "radio" FieldSelect FieldType = "select" FieldState FieldType = "state" FieldText FieldType = "text" FieldTextarea FieldType = "textarea" FieldUpload FieldType = "upload" )
type FieldsOverride ¶
FieldsOverride receives detached default block definitions and returns the complete ordered set available in the form builder.
type HandlePayment ¶
type HandlePayment func(PaymentContext) (store.Value, error)
HandlePayment performs application-owned payment work and returns the JSON value persisted with the submission. Returning an error aborts the write.
type PaymentContext ¶
type PaymentContext struct {
Context ridu.HookContext
Form store.Document
Field store.Values
SubmissionData map[string]store.Value
Total float64
}
PaymentContext is the trusted input supplied before a submission commits.
type Plugin ¶
type Plugin struct {
// contains filtered or unexported fields
}
Plugin is one configured Form Builder extension.
func New ¶
New returns one compiled plugin. Slice-bearing config is detached so later application mutation cannot change the resolved schema or runtime behavior.
func (*Plugin) Descriptor ¶
func (*Plugin) Descriptor() ridu.PluginDescriptor
Descriptor exposes deterministic backend/admin pairing metadata.