All features

Cherry Blossom feature

Gravity Forms: Form Registry

Resolves stable semantic handles to Gravity Forms forms.

Resolves stable semantic handles to Gravity Forms forms.

Capabilities and extension points

Resolves stable semantic handles to Gravity Forms forms.

Register a handle against a numeric form ID so project code does not depend on environment-specific IDs. Definitions may also contain render defaults accepted by display_form(). Register definitions programmatically or return them from the cherry/blossom/gravity_forms/forms filter.

Numeric IDs remain accepted by all lookup and rendering methods.

Programmatically registered definitions.

  • var array

Cached normalized definitions.

  • var array|null

Registry errors.

  • var array

Registers a semantic form definition.

Definitions may be a numeric form ID or an array with an id and optional render settings.

  • param string $handle Semantic form handle.
  • param int|array $definition Form ID or definition.
  • return bool Whether the definition was registered.

Removes a programmatically registered semantic form definition.

Filter-provided definitions cannot be removed here and should instead be changed through their original filter.

  • param string $handle Semantic form handle.
  • return bool Whether a programmatic definition was removed.

Gets normalized semantic form definitions.

  • return array Definitions keyed by semantic handle.

Gets a semantic form definition.

  • param string|int $form Semantic handle or form ID.
  • return array|null Form definition, or null when unresolved.

Resolves a semantic handle or numeric value to a form ID.

  • param string|int $form Semantic handle or form ID.
  • return int|null Form ID, or null when unresolved.

Gets a Gravity Forms form by semantic handle or ID.

  • param string|int $form Semantic handle or form ID.
  • return array|null Gravity Forms form configuration.

Determines whether a semantic handle or form ID resolves to a form.

  • param string|int $form Semantic handle or form ID.
  • return bool Whether the form exists.

Gets the first semantic handle registered for a form ID.

  • param int $form_id Form ID.
  • return string|null Semantic handle, or null when not registered.

Gets configured render settings for a form.

  • param string|int $form Semantic handle or form ID.
  • param array $overrides Per-render setting overrides.
  • return array Render settings.

Renders a form using its semantic handle or numeric ID.

  • param string|int $form Semantic handle or form ID.
  • param array $overrides Per-render setting overrides.
  • return string|null Form markup when echo is disabled, otherwise null.

Gets registry errors.

  • return array Error objects.

Gets default form render settings.

  • return array Default settings.

Normalizes one semantic form definition.

  • param string $handle Semantic handle.
  • param int|array $definition Raw definition.
  • return array|null Normalized definition.

Normalizes a semantic form handle.

  • param mixed $handle Raw handle.
  • return string Normalized handle.

Records a registry error.

  • param string $code Error code.
  • param string $message Error message.
  • param mixed $data Optional error data.

Source reference

This editable reference page is based on the PHP documentation in plugins/gravity-forms/class-form-registry.php.