Purpose
Primary registration hook for non-Gravity-Forms forms. Sibling plugins return their custom (programmatic) form definitions here so they appear in the mobile app’s form_data block alongside GF forms.
Use this when your sibling plugin needs a form-shaped surface that isn’t worth building in Gravity Forms (e.g., a one-field caregiver-invite acceptance, an IAP receipt-confirmation form, an in-app rating prompt).
Signature
$forms = apply_filters( 'mam_form_manager_get_forms_from_plugins', array $forms );
| Parameter | Type | Description |
|---|---|---|
$forms |
array | Array of form definitions (in mobile-renderable shape) |
Returns: array — augmented forms list.
Form shape
array(
array(
'id' => 'my_plugin_caregiver_accept',
'title' => 'Accept caregiver invitation',
'fields' => array(
array(
'id' => '1',
'type' => 'text',
'label' => 'Your name',
'required' => true,
),
// ...
),
'settings' => array(
'colors' => array( ... ),
'submit_label' => 'Accept',
),
'is_custom' => true, // signals "this isn't a GF form"
'submit_action' => 'my_plugin_caregiver_accept_handler',
),
// ...
)
| Field | Purpose |
|---|---|
id |
Unique identifier — used as the dispatch key for submissions. Convention: <plugin-slug>-<event-name>. |
title |
Display title in the app |
fields |
Mobile-shape field definitions (already transformed) |
settings |
Per-form colors, submit button copy |
is_custom |
true so the submission pipeline skips GF-specific processing |
submit_action |
Function to invoke for submissions |
Example: register a custom form
add_filter( 'mam_form_manager_get_forms_from_plugins',
function ( array $forms ): array {
$forms[] = array(
'id' => 'mam-my-plugin-rating_prompt',
'title' => 'Rate this app',
'fields' => array(
array(
'id' => '1',
'type' => 'rating',
'label' => 'Stars',
'required' => true,
'max' => 5,
),
array(
'id' => '2',
'type' => 'textarea',
'label' => 'Optional feedback',
'required' => false,
),
),
'settings' => array(
'submit_label' => 'Submit rating',
),
'is_custom' => true,
'submit_action' => 'my_plugin_rating_submit_handler',
);
return $forms;
}
);
Submission
When the app submits a custom form, the submission pipeline uses the submit_action field to dispatch. Implement the handler:
function my_plugin_rating_submit_handler( $entry, $form ) {
$stars = (int) ( $entry['1'] ?? 0 );
$body = wp_strip_all_tags( $entry['2'] ?? '' );
if ( $stars < 1 || $stars > 5 ) {
return array( 'status' => 'failure', 'message' => 'Invalid rating' );
}
$this->persist( get_current_user_id(), $stars, $body );
return array(
'status' => 'success',
'message' => 'Thanks for the feedback!',
);
}
Note: custom forms still benefit from mam_form_manager_send_notifications if you want to dispatch confirmation emails / alerts — fire it after persisting.
When to use this vs. a GF form
| Use a GF form | Use a custom form |
|---|---|
| Many fields | One or two fields |
| Admins should be able to edit fields | Fields are fixed by your plugin |
| Reuses GF features (logic, calculations, addons) | Doesn’t need GF features |
| Submission stores in GF entries | Submission stores in your plugin’s tables |
| Customer expects it in the GF entries grid | Customer manages it in your plugin’s UI |
Gotchas
idmust be globally unique across GF forms and custom forms. Prefix with your plugin slug.- Mobile-renderable shape required. Custom forms skip the GF transformation chain — your
fieldsarray must already match the mobile shape. is_custom = trueis critical. Without it, the pipeline tries to look up a GF form with that id and fails silently.- Cache invalidation still applies — when your custom form changes, invalidate via
mam_form_manager_cache_manager::invalidate( $form_id ). submit_actioncallback signature depends on your handler — coordinate with the submission pipeline (seemam_gf_submit_app_formfor the dispatch logic).
Related articles
- Forms manager overview
- Form submission lifecycle
- Custom field types
- Form cache and invalidation
Metadata
| Field | Value |
|---|---|
| Article type | Hook Reference |
| Plugin slug | mam-main |
| Applies to plugin version | 2.1.11+ |
| Hook type | filter |
| Audience | PHP developer |
| Last verified | 2026-05-02 |
