Entry Automation Entry Automation

fg_entryautomation_export_field_value

Description

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

Usage

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

Parameters

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 );