PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

new filter "gform_field_content"

  1. It would be great if you could add the following to/patch form_display.php:

    @@ -1508,6 +1508,7 @@
                         $target_input_id = $field_id;
                     $description = self::get_description(rgget("description", $field),"gfield_description");
                     $field_content = sprintf("%s<label class='gfield_label' for='%s'>%s%s</label>{FIELD}%s%s", $admin_buttons, $target_input_id, esc_html($field_label), $required_div , $description, $validation_message);
    +                $field_content = apply_filters("gform_field_content", $field_content, $field, $form_id);
                 break;
             }

    It would allow plugin authors to add (more) complex custom fields with

    add_filter( "gform_field_content",  "my_quite_complex_custom_field_content", 10, 3 );

    Thanks ;-)

    Posted 13 years ago on Sunday June 5, 2011 | Permalink
  2. Thanks for the suggestion. We'll take a look at this and get back with you. :)

    Posted 13 years ago on Monday June 6, 2011 | Permalink
  3. We have some hooks in place that allows developers to create completely new field types.
    Here are some of them

    Display the custom field type in the front end
    http://www.gravityhelp.com/documentation/page/Gform_field_input

    Adds a new button to the Admin for the new field type
    http://www.gravityhelp.com/documentation/page/Gform_add_field_buttons

    Creates new field settings to the Standard Tab
    http://www.gravityhelp.com/documentation/page/Gform_field_standard_settings

    Creates new field settings to the Advanced Tab
    http://www.gravityhelp.com/documentation/page/Gform_field_advanced_settings

    Injects supporting javascript to the form editor page
    http://www.gravityhelp.com/documentation/page/Gform_editor_js

    I hope this helps.

    Good Luck!

    Posted 13 years ago on Monday June 6, 2011 | Permalink
  4. Thanks but I was aware of these hooks and we are already using them ;-) ... unfortunately these alone didn't suffice for the plugin we are currently developing. In some cases it is necessary to completely control the way the field is rendered in the form builder/editor page - gform_field_input handles only a part of this. For example: to mimic page break's look & feel or to break out of the usual look & feel.

    Because we'd like to release our GravityForms plugin to the public as soon as it's finished (~60% done) we would need this gform_field_content hook. This plugin will allow to create repeatable sections of a form - for example: person name, email, address, phone number for n people - the form will 'grow' dynamically.

    Posted 13 years ago on Monday June 6, 2011 | Permalink
  5. Ok. Let me take a closer look at your code above and get back with you. We usually have no problems adding new hooks.

    Posted 13 years ago on Monday June 6, 2011 | Permalink
  6. Sure, we'd love a GravityForms-approved review ;-) ... I'll get back to you as soon as it's finished.

    Posted 13 years ago on Monday June 6, 2011 | Permalink
  7. sandman18
    Member

    @25th-floor
    Are you building a plugin for gravity forms that would make it easier to design?

    Posted 13 years ago on Monday June 6, 2011 | Permalink
  8. I am thinking of adding the hook a little further down in that function (around line 1519). That way, it would apply to all fields. This is what I am thinking:

    $field_content = str_replace("{FIELD}", GFCommon::get_field_input($field, $value, 0, $form_id), $field_content);
    $field_content = apply_filters("gform_field_content", $field_content, $field, $value, $form_id);
    return $field_content;

    If this works for you, we can include it in the next version.

    Posted 13 years ago on Monday June 6, 2011 | Permalink
  9. Sounds reasonable but It would be nice to have gform_field_content before GFCommon::get_field_input() - and therefore the gform_field_input hook. This way you can control where {FIELD} will be 'positioned' in the result.

    Posted 13 years ago on Tuesday June 7, 2011 | Permalink
  10. @sandman18> no, the form builder is working very well, no need to change that ... our plugin adds a custom field that allows infinite/dynamically repeating groups of fields.

    Posted 13 years ago on Tuesday June 7, 2011 | Permalink
  11. Hi again,

    about a month has passed and we've quite finished our GravityForms Bulk-Fields Plugin (or GF MultiFields, not sure about the final name yet). Unfortunately the latest release of GF is still missing the proposed (and required) "gform_field_content" hook :-(

    Would you, the guys and girls of rocketgenius/GF be interested in reviewing the plugin and it's functionality? - it would be an honor and eventually you'll like our enhancements. If so, where can we put the current development version for you to review?

    Thanks in advance!

    Posted 13 years ago on Wednesday July 20, 2011 | Permalink
  12. /push ;-)

    Posted 13 years ago on Wednesday July 27, 2011 | Permalink
  13. @25th-floor I wasn't involved in this support thread so I wasn't aware you were working on an Add-On. We would love to hear about it. Email me directly at carl@rocketgenius.com and let me know the details, if you have a test version to look at, etc.

    If there are any issues not resolved in this forum thread (I haven't read through it all) let me know in that email and I can see what I can do to get them worked out. We definitely want to assist developers in creating add-ons.

    Posted 13 years ago on Wednesday July 27, 2011 | Permalink