MetaField

Gravity Forms adds some data on top of the fields in a form. Things like an IP address, a timestamp, etc. All this meta data is being provided by a single meta field. Therefor I created this MetaField class. This way you can target every individual meta field in the Excel for changing, and it has it's own filters.

Because these meta fields closely resemble the other fields, the plugin has a tiny meta fields Transformer baked in. This allows you to (also) register your own (custom) MetaField instances. You can add your fields via the filter. The plugin actually already has a custom MetaField called DateCreatedField.

Filters

  • gfexcel_meta_value_{field_id}_{form_id}
    Just as it's big brother for the field value, this filter can change the value of this meta field. The extra options are reversed on purpose, because it's more likely you'll want to change every meta field (type), that for a specific form.

    Example

    // only update the ip field.
    add_filter('gfexcel_meta_value_ip', function ($value, $entry, $field) {
      return 'IP:' . $value;
    }, 10, 3);
  • gfexcel_transformer_subfields
    This filter allows you to add your own (custom) MetaField instance for a specific type. Let say you created a IpAddressField and you want to register it for the ip field.

    add_filter('gfexcel_transformer_subfields', function ($fields) {
      $fields['ip'] = 'Your\Full\Namespace\IpAddressField';
      return $fields;
    });

DateCreatedField

This actually is a custom MetaField instance, that allows you to split the timestamp into two fields; Date and Time.

Filters

  • gfexcel_meta_date_created_separated_{form_id}
    allows you to separate the timestamp into two fields.

    Example

    // split date_created into date and time fields
    add_filter('gfexcel_meta_date_created_separated', '__return_true');