Purpose
Build-time transformer for custom Gravity Forms field types. When the forms-manager subsystem encounters a GF field tagged with a custom type, it fires this filter so a sibling plugin can translate the GF schema into a mobile-renderable shape.
Custom field types require two hooks — this filter for build-time, plus a corresponding submit-time handler. Forgetting one breaks the round trip silently. See Custom field types.
Signature
$field['value'] = apply_filters(
'mam_form_manager_process_field_type_' . $type,
$field['value'], // the mobile field's current value (mutate and return)
$form_field['value'], // the raw value for this field from the form data
$field // the mobile-shape field array (context)
);
The filter fires from form-data-manager.php‘s field-processing loop, in the default
branch — i.e. only for field types that aren’t one of the built-in cases
(choice, multiselect, hidden, date, time, …), and only when a subscriber to
mam_form_manager_process_field_type_{type} exists. It is passed three arguments.
| Parameter | Type | Description |
|---|---|---|
$field['value'] |
mixed | The mobile field’s current value. This is the value being filtered — mutate and return it. |
$form_field['value'] |
mixed | The raw value for this field from the incoming form data |
$field |
array | The mobile-shape field array (for context) |
Returns: mixed — the new field value (assigned straight back into $field['value']), not a whole field-data array.
Example: signature pad field type
add_filter( 'mam_form_manager_process_field_type_signature_pad',
function ( $value, $raw_value, array $field ) {
// Normalise the raw submitted value into whatever the mobile
// signature-pad renderer expects for this field.
if ( '' === $raw_value ) {
return $value;
}
return trim( $raw_value );
},
10, 3
);
The mobile renderer for a field is chosen from $field['type'] (set when the field
is built), not from the value returned here — this filter only shapes the field’s
value. Coordinate with the mobile team on the value format the renderer expects.
How {type} resolves
The {type} segment comes from one of:
- The GF field’s
customFieldTypesetting (configured in Mobile App Manager → Forms → [form] → Special handling) - A built-in field type slug (
text,email,phone, etc.) for which the standard handler runs first - A sibling-plugin-injected type via
mam_populate_gravity_formaugmentation
The two-hook pattern
Custom field type registration requires:
| Hook | Direction | Purpose |
|---|---|---|
mam_form_manager_process_field_type_{type} (this filter) |
Build → app | Translate to mobile shape |
Per-form submission handler (e.g., mam_for_gravity_forms_form_submitted_{form-id}) |
App → server | Validate and persist |
Forgetting the second one means submissions of your custom field accept any value silently.
See Custom field types for the recipe.
Cache invalidation
The transformed shape is cached per form id (mam-form-cache-{form_id}). When you change the build-time transform — adding a new setting that affects output — invalidate:
mam_form_manager_cache_manager::invalidate( $form_id );
See Form cache and invalidation.
Gotchas
- Two hooks, one will silently break. A value transform without a submit-time handler accepts any value; a submit-time handler without this transform renders the raw value.
- Return the value, not a field array. Whatever you return is assigned straight into
$field['value']. Returning an array replaces the value with an array. - Cache invalidation lives in the cache manager. Don’t delete cache options directly.
- Mobile client coordination required. The value format is meaningless without a client renderer that expects it.
- Built-in cases run first.
choice,multiselect,hidden,date, andtimeare handled by dedicatedhandle_*_field()methods; your custom-type filter only fires in thedefaultbranch for other types. - Only fires when a subscriber exists. The loop guards with
has_filter()— with no subscriber, the field value passes through as$form_field['value']unchanged.
Related articles
- Forms manager overview
- Form submission lifecycle
- Custom field types
- Form cache and invalidation
- Hook: mam_for_gravity_forms_formsubmitted{id}
- Hook: mam_form_manager_send_notifications
Metadata
| Field | Value |
|---|---|
| Article type | Hook Reference |
| Plugin slug | mam-main |
| Applies to plugin version | 2.1.11+ |
| Hook type | filter (dynamic — {type} is replaced with your field-type slug) |
| Audience | PHP developer |
| Frozen contract | yes (the dynamic-filter pattern; specific {type} values are extension-defined) |
| Last verified | 2026-05-02 |
