AbstractFieldComponent
Shared mount/handle plumbing for the form field primitive family (input, textarea, select, checkbox): common `dirty`/`touched`/`error` state, and the four `change`/`blur`/`reset`/`set-error` actions every field supports. Concrete subclasses implement {@see contract()} and, when their value isn't a plain string (e.g. checkbox's boolean), override {@see valueKey()} / {@see initialValue()}.
AbstractFieldComponent::__construct()
public function __construct(?Milpa\Interfaces\Event\MilpaEventDispatcherInterface $dispatcher = null):Parameters
| Name | Type | Description |
|---|---|---|
| $dispatcher | ?Milpa\Interfaces\Event\MilpaEventDispatcherInterface |
AbstractFieldComponent::contract()
abstract public static function contract(): Milpa\Live\ValueObjects\ComponentContractThe subclass's runtime contract (name, props/state schema, actions).
AbstractFieldComponent::mount()
public function mount(array $props, Milpa\Live\ValueObjects\ComponentContext $context): Milpa\Live\ValueObjects\StateSnapshotBuilds the initial state from {@see initialValue()} plus common `dirty`/`touched`/`error` fields, and captures `name`/`label`/ `required`/`disabled`/`hint`/`persistKey` props (merged with {@see meta()}) as mount-time meta.
Parameters
| Name | Type | Description |
|---|---|---|
| $props | array<string, mixed> | |
| $context | Milpa\Live\ValueObjects\ComponentContext |
AbstractFieldComponent::handle()
public function handle(Milpa\Live\ValueObjects\InteractionRequest $request): Milpa\Live\ValueObjects\InteractionResultDispatches to `change`/`set` (aliases), `blur`, `reset`, and `set-error`; an unrecognized action is reported via {@see InteractionResult::$errors}.
Parameters
| Name | Type | Description |
|---|---|---|
| $request | Milpa\Live\ValueObjects\InteractionRequest |