Forms manager overview

What it does

forms-manager (includes/forms-manager/) bridges Gravity Forms into the mobile app. Customer admins build forms in WP using Gravity Forms; this subsystem caches them, transforms them into a mobile-app-renderable shape, processes app-side submissions, and routes results back through the notification dispatcher.

The five primary responsibilities:

  1. Form discovery — pulls Gravity Forms definitions plus forms registered by sibling plugins (mam_form_manager_get_forms_from_plugins)
  2. Caching — serialized form definitions cached in options (mam-form-cache-*) to avoid repeated GF API calls during phone-data builds
  3. Mobile transformation — converts GF schema into mobile-app field types, fires per-field-type filters so sibling plugins can extend
  4. Submission handling — receives app submissions via AJAX, runs validation, fires post-process filters and mam_form_manager_send_notifications
  5. Phone manager — separate concern: validates SMS phone numbers used for verification codes and notification opt-in

Public surface

Class Role
mam_forms_manager Top-level orchestrator
mam_for_gravity_forms_forms_manager GF integration entry — discovers, caches, transforms
mam_form_manager_form_processor Submission validation + side-effect dispatch
mam_form_manager_cache_manager Serialized form-definition cache
mam_forms_manager_phone_manager Phone-number normalization + validation
mam_forms_manager_image_manager Image-field upload pipeline
mam_gf_submit_app_form App-side submission AJAX endpoint
mam_gf_standard_form_handler Default field-type processor

AJAX endpoints

Action Auth Purpose
mam_gf_ajax_handler both GF admin operations
mam_gf_save_special_handling logged-in Save per-field special-handling config
mam_gf_help_screen_handler logged-in Help screen content

The app’s form-submission AJAX is registered separately by mam_gf_submit_app_form.


Hooks fired (extension surface)

Form discovery

Hook Type Purpose
mam_form_manager_get_forms_from_plugins Filter Primary registration hook. Sibling plugins return their custom (non-GF) forms here
mam_form_manager_get_from_plugins Filter Per-plugin retrieval helper
mam_gf_get_all_forms Filter All known GF forms
mam_gf_get_custom_forms_list Filter Custom forms list
mam_gf_get_custom_form Filter Single custom form fetch
mam_gf_get_form Filter Single GF form fetch
mam_gf_get_form_data Filter Form data block
mam_gf_get_form_settings Filter Form settings block
mam_gf_get_cpt_for_form_id Filter Resolve associated post type

Pre-send transformation

Hook Type Purpose
mam_populate_gravity_form Filter Initial transformation pass
mam_populate_gravity_form_final Filter Final transformation pass
mam_form_manager_precached_field Filter Per-field pre-cache hook
mam_form_manager_process_field_type_{type} Filter (dynamic) Per-field-type custom processor — sibling plugins implement custom field types here
mam_gf_populate_form_data_with_post_meta Filter Post-meta hydration
mam_update_form_before_sending Filter Last-chance pre-send mutation
mam_update_form_before_sending_{form-id} Filter (dynamic) Per-form last-chance mutation

Submission lifecycle

Hook Type Purpose
mam_gf_processing_form Action Fired when a GF submission begins processing
mam_form_manager_form_submitted_{form-id} Filter (dynamic) Per-form submission handler
mam_for_gravity_forms_form_submitted_{form-id} Filter (dynamic) Per-form GF submission handler
mam_for_gravity_forms_form_result_form_{form-id} Filter (dynamic) Per-form result builder
mam_for_gravity_forms_form_result Filter Generic result builder
mam_for_gravity_forms_form_result_v2 Filter V2 result envelope
mam_form_manager_send_notifications Action Submission post-process hook. Subscribers fire do_action('mam_notification_send_message', …) here to email/SMS/PN the result

Admin UI

Hook Type Purpose
mam_gf_settings_tab_tabs_list Filter Inject custom tabs into the GF settings page
mam_gf_settings_tab_content Filter Render content for a custom tab
mam_form_manager_content_class_{class} Filter (dynamic) Per-content-class form integration

Reads / writes

  • Owned options: mam_forms_db_version, mam_gravity_forms_db_version, mam_generated_forms, mam_gd_forms, mam_forms_colors_defaults_set, mam_forms_colors_defaults_set_{role}, mam_theme_color_dark, mam_theme_color_light, mam-for-gf-form-field-display-*
  • External: Gravity Forms native tables + wp_postmeta
  • Phone validation: Optional integration with a phone-number validation service if configured

Gotchas

  • Cache invalidation is the hard part. Form schemas are cached aggressively because the phone-data pipeline rebuilds JSON on every app load. A stale cache means admins update a form and the app keeps showing the old version. The cache manager keys by form id + relevant settings; if you add a setting that changes form output, invalidate the cache when it’s written.
  • Custom field types require two hooksmam_form_manager_process_field_type_{type} to translate at build time, AND a corresponding submit-time handler so submissions of that field validate. Forgetting one breaks the round trip silently.
  • Per-form dynamic hooks are the per-form override pattern. If you need a customer-specific transformation, hook mam_for_gravity_forms_form_submitted_{their-form-id} rather than the generic version.
  • mam_form_manager_send_notifications is the contract between forms-manager and notifications-manager. Don’t fire mam_notification_send_message directly from form-handling code — go through this action so admin overrides can intercept.
  • mam_gf_user_profile_submit_title etc. are user-roles hooks that flow into this subsystem — user profile screens are rendered as forms.

  • Plugin: mam-main
  • Form submission lifecycle
  • Custom field types
  • Form cache and invalidation
  • Phone validation
  • Hook: mam_form_manager_get_forms_from_plugins
  • Hook: mam_form_manager_process_fieldtype{type}
  • Hook: mam_form_manager_send_notifications
  • Hook: mam_for_gravity_forms_form_resultform{id}

Metadata

Field Value
Article type Plugin Overview
Plugin slug mam-main
Applies to plugin version 2.1.11+
Category Plugin Reference
Audience PHP developer
Last verified 2026-05-02
Contents

    Need Support?

    Can’t find the answer you’re looking for? Don’t worry we’re here to help!