Hiya,
I'm writing a plugin to GravityForms that adds some custom field types, and other miscellaneous bits. It's going well, but there's a couple places in GravityForms that would be lovely to have the apply_filters() and do_action() calls actually in there natively, so I don't have to 'hack core' (so to speak).
They are:
/js.php
In the midst of the massive switch() statement, within the SetDefaultValues() function, if you could add (somewhere in there) the following:
<?php do_action("gform_editor_js_set_default_values"); ?>
that would enable people to add 'catchers' for the custom field types.
---
/form_display.php
Toward the end of the function get_form(), if you could change the return statement return $form_string;
to:
return apply_filters("gform_get_form_filter",$form_string);
that would enable modules to use preg_replace and custom placeholder strings to let forms generate dynamic options for dropdowns and the like, along with any number of other customizations that I've not even dreamed of.
---
/form_detail.php
At the very end of the file, in the save_form() function, if you could add two actions, both just before the die() statements ... before die("EndUpdateForm($id);");
, add
do_action( "gform_edit_existing_form", $id, $form_meta );
and before die("EndInsertForm($id);");
, add
do_action( "gform_add_new_form", $id, $form_meta );
These changes would let developers trigger events on people either saving a new form, or updating an existing form. For example (as in my use case), creating a new post (custom post type) automatically, whenever a form is made, to streamline workflow.
---
Thanks! I may have some other places to request hooks later on, but that's it for now (I think). It strikes me as these filters and hooks would be the work of a moment to include on your end, and increase significantly the extensibility of your plugin.