Cms\Behaviors\WizardComponent
Overview
WizardComponent behavior adds multi-step form handling to CMS components.
This behavior extends FormComponent with multi-step submissions, where each step validates and saves the subset of fields carrying the posted form tag against the same record. The record is created by the first step as a partial submission and tracked in the visitor session until the final submit completes it, so a lead is captured even when later steps are abandoned. Visitors can move forward and back between steps without losing earlier input, since every step is persisted to the record.
Fields opt into wizard steps with a tags property, accepting an array
or a singular string. A blueprint without tagged fields has no valid form
tags and cannot be stepped through.
Components using this behavior should implement formMarkPartial and formMarkComplete so incomplete records can be distinguished, and may override formFindPartialModel to constrain how partial records resolve.
Usage in a component:
public $implement = [
\Cms\Behaviors\WizardComponent::class,
];
Extends
Public Properties
There are no public properties in the class.
Show inherited public properties
Inherited Public Properties
- $extendableStaticCalledClass - is the calling class when using a static method. (defined in October\Rain\Extension\ExtensionBase)
Protected Properties
There are no protected properties in the class.
Show inherited protected properties
Inherited Protected Properties
- $htmlTypeMap - maps blueprint field types to HTML input types. (defined in Cms\Behaviors\FormComponent)
- $skippedTypes - are field types not renderable in auto-generated forms. (defined in Cms\Behaviors\FormComponent)
- $component - class. (defined in Cms\Classes\ComponentBehavior)
- $controller - to CMS controller. (defined in Cms\Classes\ComponentBehavior)
- $requiredProperties - that must exist in the component using this behavior. (defined in Cms\Classes\ComponentBehavior)
- $extensionHidden - are properties and methods that cannot be accessed. (defined in October\Rain\Extension\ExtensionBase)
- $configPath - specifies a path to the config directory. (defined in Cms\Classes\ComponentBehavior)
Public Methods
public formFindPartialModel()
public formFindPartialModel(
$model,
$recordId
): October\Rain\Database\Model|null
formFindPartialModel locates a previously deferred model by its primary key
public formGetFieldConfigByTag()
public formGetFieldConfigByTag($tag): array
formGetFieldConfigByTag returns field configuration for fields carrying the tag, throwing an exception when the tag matches nothing to prevent a validation bypass.
public formGetFields()
public formGetFields($tag = null): array
formGetFields returns field metadata including tags, with an optional tag argument limiting the result to fields carrying that tag.
public formGetSessionKey()
public formGetSessionKey(): string
formGetSessionKey returns the session key used to track partial submissions
public formMarkComplete()
public formMarkComplete($model): void
formMarkComplete clears the incomplete flag from the model before the final save
public formMarkPartial()
public formMarkPartial($model): void
formMarkPartial flags the model as an incomplete submission before a deferred save
public formResolveDeferredModel()
public formResolveDeferredModel(): void
formResolveDeferredModel returns the partial model tracked by the session, or a newly created model when no valid partial submission exists.
public onFormGoto()
public onFormGoto(): void
onFormGoto navigates a multi-step form to the step named by _form_goto without validating or saving, displaying the already-saved values. This is the "Back" action, so the visitor never loses earlier input. An empty _form_goto returns to the first step.
public onFormStep()
public onFormStep(): void
onFormStep advances a multi-step form, validating and saving the fields of the step named by the posted _form_step value. This is the "Next" action, and the saved step becomes the active step.
public onFormSubmit()
public onFormSubmit(): void
onFormSubmit completes a deferred submission tracked by the session, or falls back to saving a new record, enforcing the full rule set.
Inherited Public Methods
- __construct() - the behavior. (defined in Cms\Classes\ComponentBehavior)
- beforeDisplay() - seeds the default form page variables so templates can reference them before submission. (defined in Cms\Behaviors\FormComponent)
- extend() - this class with a closure. (defined in October\Rain\Extension\ExtensionBase)
- extensionApplyInitCallbacks() - (defined in October\Rain\Extension\ExtensionBase)
- extensionExtendCallback() - is a helper method for
::extend()static method. (defined in October\Rain\Extension\ExtensionBase) - extensionIsHiddenMethod() - (defined in October\Rain\Extension\ExtensionBase)
- extensionIsHiddenProperty() - (defined in October\Rain\Extension\ExtensionBase)
- formCoerceRelationValues() - lets the component apply relation-backed values under its own trust rules. (defined in Cms\Behaviors\FormComponent)
- formGetFieldNames() - returns the allowed field names from the config. (defined in Cms\Behaviors\FormComponent)
- formGetFileFieldNames() - returns field names that accept uploaded files. (defined in Cms\Behaviors\FormComponent)
- formGetRejectedTypes() - returns field types that never accept postback values. (defined in Cms\Behaviors\FormComponent)
- formGetThrottleRate() - returns the maximum submissions per minute per IP, zero to disable. (defined in Cms\Behaviors\FormComponent)
- formHasFileFields() - returns true if the form contains file upload fields. (defined in Cms\Behaviors\FormComponent)
- formValidateFile() - validates a single uploaded file against size and extension rules. (defined in Cms\Behaviors\FormComponent)
- getCalledExtensionClass() - (defined in October\Rain\Extension\ExtensionBase)
- getConfigPath() - locates a file based on it's definition. If the file starts with. (defined in Cms\Classes\ComponentBehavior)
- guessConfigPath() - guesses the package path for the called class. (defined in Cms\Classes\ComponentBehavior)
- guessConfigPathFrom() - guesses the package path from a specified class. (defined in Cms\Classes\ComponentBehavior)
- makeConfig() - reads the contents of the supplied file and applies it to this object. (defined in Cms\Classes\ComponentBehavior)
- makeConfigFromArray() - makes a config object from an array, making the first. (defined in Cms\Classes\ComponentBehavior)
- mergeConfig() - merges two configuration sources, either prepared or not, and returns. (defined in Cms\Classes\ComponentBehavior)
Protected Methods
protected formSaveStep()
protected formSaveStep($model, $tag): void
formSaveStep validates the tagged fields and saves them to the partial record
Show inherited protected methods
Inherited Protected Methods
- extensionHideMethod() - (defined in October\Rain\Extension\ExtensionBase)
- extensionHideProperty() - (defined in October\Rain\Extension\ExtensionBase)
- formCheckThrottle() - enforces the submission rate limit for the visitor. (defined in Cms\Behaviors\FormComponent)
- formGetAllowedFileTypes() - returns the allowed extensions for a file field. (defined in Cms\Behaviors\FormComponent)
- formGetValidatedFiles() - returns uploaded files for file fields after validation. (defined in Cms\Behaviors\FormComponent)
- getConfigValueFrom() - will apply the config getter convention. (defined in Cms\Classes\ComponentBehavior)