input ​
File: src/Helpers/input.php
Form input processing helpers — the PHP side of the Modularous form schema pipeline. These functions hydrate, normalize, and extend input definitions before they are serialized to the frontend.
Pipeline Overview ​
configure_input()
↓
hydrate_input_type() → merges registered input-type presets
↓
hydrate_input_connector() → resolves connector endpoint/repository
↓
format_input() → type-specific logic (group, wrap, morphTo, polymorphic, title)
↓
hydrate_input() → runs InputHydrator
↓
hydrate_input_extension() → processes ext patterns (permalink, filter, toggle, etc.)
↓
modularous_format_input() → merges with default input, keys by name
↓
modularous_format_inputs() → maps over schema arrayFunctions ​
configure_input ​
configure_input(array $input): arrayNormalizes shorthand input config. Numeric keys (flags like 'required') are converted to ['required' => true] key-value pairs. Label keys are auto-translated via ___('form-labels.*').
modularous_default_input ​
modularous_default_input(): arrayReturns the default input configuration from modularous.default_input config key. Merged into every input by modularous_format_input.
hydrate_input_type ​
hydrate_input_type(array $input): arrayLooks up $input['type'] in modularous.input_types config and merges the preset defaults with the provided input array. Allows centralized type defaults (e.g. all select inputs get itemValue: 'id' automatically).
hydrate_input_connector ​
hydrate_input_connector(array &$input, string $moduleName = null, string $routeName = null): voidResolves connector shorthand strings to actual endpoint URLs or repository class references. Connector format:
'moduleName:routeName|uri:index'
'moduleName:routeName|repository:list'hydrate_input_extension ​
hydrate_input_extension(array &$input, &$data, &$arrayable, array $inputs): voidProcesses the ext key on an input definition. Supported extension patterns:
| Pattern | Effect |
|---|---|
date / time | Sets default to current date/time |
permalink:slug | Adds a readonly slug input and a formatPermalink event |
permalinkPrefix:slug | Adds a formatPermalinkPrefix event |
lock:url:url | Adds a formatLock event |
filter:target:prop | Resolves a filter endpoint and adds formatFilter event |
preview:field | Adds formatPreview event |
set:target:prop | Adds formatSet event |
clearModel:target | Adds formatClearModel event |
resetItems:target | Adds formatResetItems event |
prependSchema:... | Adds formatPrependSchema event |
removeValue:target | Adds formatRemoveValue event |
toggleInput:target:value:level | Adds formatToggleInput event |
Events are stored pipe-delimited in $input['event'] and consumed by the Vue form engine.
hydrate_input ​
hydrate_input(array $input, $module = null, $routeName = null, $skipQueries = null): arrayDelegates to InputHydrator::hydrate() — the class-based hydration layer that handles relationships, repositories, and query-based item population.
format_input ​
format_input(array $input, ...): arrayHandles type-specific input processing:
group/wrap: Builds nested schema with parent name prefixing and default collectionmorphTo: Builds cascading select inputs for polymorphic foreign key selectionpolymorphic: Splits into a type combobox and an ID combobox from amorphsarraytitle: Applies display defaults (padding, weight, class, color)
Returns [$processedInput, $isArrayable].
modularous_format_input ​
modularous_format_input(array $input, ...): arrayFull pipeline entry for a single input: resolves closures, calls format_input, merges defaults, applies configure_input, and returns ['name' => $normalizedInput].
modularous_format_inputs ​
modularous_format_inputs(array $inputs, ...): arrayMaps modularous_format_input over an array of input definitions, returning the keyed schema array ready for the frontend.