Form
Corex\Forms\Form · class · Forms layer
A code-defined form: its slug, its field definitions, its wording, and the listeners that handle its submissions. The single source feeding the schema resolver, the submit endpoint, and the block. A concrete form sets $slug and $fields.
Public API
Section titled “Public API”fields(): array
Section titled “fields(): array”label(): string
Section titled “label(): string”A human label for the form, shown in the block’s form selector. Defaults to a humanized slug; a concrete form may override for a nicer name.
submitLabel(): string
Section titled “submitLabel(): string”What the submit button reads. Empty, the default, is CoreX’s own label; so is a label of nothing but spaces, because a button needs a name.
successMessage(): string
Section titled “successMessage(): string”What a visitor is told when a submission is accepted. Empty, the default, is CoreX’s own confirmation.
errorMessage(): string
Section titled “errorMessage(): string”What a visitor is told, beside each field’s own message, when a submission is refused for its answers. Empty, the default, is CoreX’s own wording.
protection(): array
Section titled “protection(): array”Whether a submission must pass the site’s challenge provider. Off by default: return ['captcha' => 'on'] to ask for it. action and threshold may be added for a provider that scores a visitor; without them the action is derived from the slug and the threshold is the site’s. On a site with no provider configured a protected form is accepted under the trap field, the security token and the rate limit, as every form is.
markup(FormParts $parts): ?string
Section titled “markup(FormParts $parts): ?string”The form’s own markup, built from the parts it is handed; null, the default, is the form CoreX draws. The markup must hold $parts->attributes() on its <form>, and $parts->hidden() and $parts->status() inside it. Each field needs a wrapper carrying $parts->fieldAttributes($name) that holds its control and $parts->error($name).
listeners(): array
Section titled “listeners(): array”Listener service ids for this form’s submissions. The default set stores the submission and emails a notification; concrete forms may override.