All features

Cherry Blossom feature

Gravity Forms: Developer Registry

Registers reusable Gravity Forms developer callbacks.

Registers reusable Gravity Forms developer callbacks.

Capabilities and extension points

Registers reusable Gravity Forms developer callbacks.

Definitions require a callback and can declare a priority. The forms and fields keys limit execution to semantic form handles, numeric form IDs, and field or input IDs. Notification registrations can additionally use the notifications key to target notification IDs or names.

Population registrations use parameter; merge tags use tag and label; and validation registrations can provide a fallback message. Callbacks receive the relevant native Gravity Forms values followed by the normalized definition and this registry instance, providing a consistent extension contract across projects.

Supported developer registry types.

  • var array

Programmatically registered definitions.

  • var array

Cached normalized registries.

  • var array

Registry errors.

  • var array

Initializes developer registry dispatch.

Registers generic Gravity Forms dispatch hooks.

Registers a dynamic population callback.

  • param string $name Registration name and default parameter.
  • param callable|array $definition Callback or registration definition.
  • return bool Whether registration succeeded.

Registers a field validation callback.

  • param string $name Registration name.
  • param callable|array $definition Callback or registration definition.
  • return bool Whether registration succeeded.

Registers a saved-value sanitization callback.

  • param string $name Registration name.
  • param callable|array $definition Callback or registration definition.
  • return bool Whether registration succeeded.

Registers a custom merge tag.

  • param string $name Registration name and default tag.
  • param callable|array $definition Callback or registration definition.
  • return bool Whether registration succeeded.

Registers an after-submission handler.

  • param string $name Registration name.
  • param callable|array $definition Callback or registration definition.
  • return bool Whether registration succeeded.

Registers a notification routing callback.

  • param string $name Registration name.
  • param callable|array $definition Callback or registration definition.
  • return bool Whether registration succeeded.

Registers a developer callback definition.

  • param string $registry Registry type.
  • param string $name Registration name.
  • param callable|array $definition Callback or definition.
  • return bool Whether registration succeeded.

Removes a programmatically registered developer definition.

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

  • param string $registry Registry type.
  • param string $name Registration name.
  • return bool Whether a programmatic definition was removed.

Determines whether a developer definition exists.

  • param string $registry Registry type.
  • param string $name Registration name.
  • return bool Whether the definition exists.

Gets the supported developer registry types.

  • return array Registry type names.

Gets a normalized developer registry.

Registry definitions can be added through the corresponding cherry/blossom/gravity_forms/developers/{registry} filter.

  • param string $registry Registry type.
  • return array Normalized definitions.

Gets developer registry errors.

  • return array Error objects.

Dispatches a dynamic population value.

  • param mixed $value Current value.
  • param \GF_Field $field Field object.
  • param string $name Dynamic population parameter.
  • return mixed Filtered value.

Dispatches field validation callbacks.

A callback may return a Gravity Forms result array, false, an error message string, or null to retain the current result.

  • param array $result Current validation result.
  • param mixed $value Submitted field value.
  • param array $form Form configuration.
  • param \GF_Field $field Field object.
  • param string $context Submission context.
  • return array Filtered validation result.

Dispatches saved-value sanitization callbacks.

  • param mixed $value Value being saved.
  • param array $entry Entry data.
  • param \GF_Field $field Field object.
  • param array $form Form configuration.
  • param string $input_id Input identifier.
  • return mixed Filtered value.

Adds registered merge tags to the Gravity Forms merge-tag picker.

  • param array $merge_tags Existing custom merge tags.
  • param int $form_id Form ID.
  • param array $fields Form fields.
  • param string $element_id Editor element ID.
  • return array Filtered merge tags.

Replaces registered merge tags.

  • param string $text Text containing merge tags.
  • param array|false $form Form configuration.
  • param array|false $entry Entry data.
  • param bool $url_encode Whether values should be URL encoded.
  • param bool $esc_html Whether values should be HTML escaped.
  • param bool $nl2br Whether newlines should become HTML breaks.
  • param string $format Requested output format.
  • return string Filtered text.

Dispatches registered after-submission handlers.

  • param array $entry Entry data.
  • param array $form Form configuration.

Dispatches notification routing callbacks.

  • param array $notification Notification configuration.
  • param array $form Form configuration.
  • param array $entry Entry data.
  • return array Filtered notification.

Normalizes one developer callback definition.

  • param string $registry Registry type.
  • param string $name Registration name.
  • param callable|array $definition Callback or definition.
  • return array|null Normalized definition.

Resolves a callback, including method names on this registry.

  • param mixed $callback Raw callback.
  • return callable|null Resolved callback.

Determines whether a definition targets a form.

  • param array $definition Callback definition.
  • param array|false $form Form configuration.
  • return bool Whether the definition applies.

Determines whether a definition targets a field or input.

  • param array $definition Callback definition.
  • param \GF_Field $field Field object.
  • param string $input_id Optional input identifier.
  • return bool Whether the definition applies.

Determines whether a definition targets a notification.

  • param array $definition Callback definition.
  • param array $notification Notification configuration.
  • return bool Whether the definition applies.

Formats a merge-tag value for its requested context.

  • param mixed $value Raw value.
  • param bool $url_encode Whether to URL encode.
  • param bool $esc_html Whether to HTML escape.
  • param bool $nl2br Whether to convert newlines.
  • return string Formatted value.

Normalizes a list of scalar targeting values.

  • param mixed $values Raw values.
  • return array Normalized values.

Sorts registry definitions by priority.

  • param array $definitions Definitions passed by reference.

Normalizes a supported registry type.

  • param mixed $registry Raw registry type.
  • return string|null Registry type, or null when unsupported.

Records an invalid callback error.

  • param string $registry Registry type.
  • param string $name Registration name.

Records a developer 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-developer-registry.php.