formcierge_dynamic_source_enrich_item
Filter

Since v1.1.0

Enrich a single item returned by a dynamic source before it is sent to the front-end dropdown.

Parameters
$item array Item array with at minimum keys: value, label.
$source_id string The identifier of the dynamic source.
Defined in
includes/Fields/DynamicSourceField.php
add_filter( 'formcierge_dynamic_source_enrich_item', function ( $item, $source_id ) {
    if ( $source_id === 'my_products' ) {
        $item['description'] = get_post_meta( $item['value'], '_short_desc', true );
    }
    return $item;
}, 10, 2 );