fg_entryautomation_export_field_value

Description

This filter allows you to modify the field value before it is included in the export file.

Usage

PHP
add_filter( 'fg_entryautomation_export_field_value', 'your_function_name', 10, 5 );

Parameters

  • $field_value string
    Value of the field being exported.
  • $form array
    The current automation Task’s Form.
  • $field_id string
    The ID of the current field.
  • $entry array
    The current Entry being exported.
  • $task Task
    The current automation Task object.

Examples

Use Choice Text Instead of Values

PHP
/**
 * Use choices text instead of values when exporting entry.
 *
 * @param string                          $field_value Value of the field being exported.
 * @param array                           $form        The Form object.
 * @param string                          $field_id    The ID of the current field.
 * @param array                           $entry       The Entry object.
 * @param ForGravity\EntryAutomation\Task $task        Entry Automation Task meta.
 */
add_filter( 'fg_entryautomation_export_field_value', function( $value, $form, $field_id, $entry, $task ) {

	$field = GFAPI::get_field( $form, $field_id );

	return is_object( $field ) && is_array( $field->choices ) ? $field->get_value_export( $entry, $field_id, true ) : $value;

}, 10, 5 );