Load plugin only if needed and field is used

I wrote custom field as a plugin, it uses hooks and filters to work with gravity forms…

But now it’s loaded and hooked every time with every form, even if that field exits only in one form.

  1. What’s the best way to add it ONLY if the special field exists in the form
  2. And does the submit hooks also know the form we are submitting so that it’s not too late

using filters and add_action hooks like admin_init, gform_loaded, gform_field_validation, gform_enqueue_scripts and GF_Fields::register

© 2008 - 2021. Gravity Forms is a project by Rocketgenius Inc.