SeparableField

A bunch of form fields are multipart fields. Fields like name, address, creditcard all have multiple inputs, and can therefor be either in a single column, combined by a newline, or be split up into multiple columns. This class is responsible for splitting up these inputs in to multiple columns.

The Transformer checks if a field has multiple inputs, and if so chooses SeparableField by default.

Filters

  • gfexcel_field_separated_{type}_{form_id}_{field_id}
    Using this filter you can enable or disable the separability of a specific field. Just use the __return_true and __return_false functions from Wordpress for this.

  • gfexcel_field_label_{type}_{form_id}_{field_id}
    This filter is a default filter for all fields, but here it can be used to manipulate the label for every column. By default the label is the same as the field name, unless you've provided a custom label on the field.

  • gfexcel_field_value_{type}_{form_id}_{field_id}
    This filter is also the default filter for a field, but it now also targets every column available for this field.

  • gfexcel_field_*type*_fields
    This is a bit of an odd (named) filter. You can use it to change the input this field has. But because the type is actually necessary to target the correct field, this isn't an optional piece. That's why I've contained it IN the name of the filter. So just update *type* to something like address or name.

    Example

    add_filter('gfexcel_field_address_fields', function($fields, $entry) {
      //manipulate these fields
      return $fields;
    }, 10, 2);
    

Extendability

This class is the base for all multiple input fields, and it is great for extension if you have a (custom) separable field. Please see ProductField, as this is an extension of SeparableField.