gravityflowfolders_folder_match_add_step

Added in version 1.4

The gravityflowfolders_folder_match_add_step filter allows determination of whether entry should be added to a folder to be customized.

Parameters

Parameter Type Definition
$setting_key_match Boolean Does the folder match current step settings.
$folder Array The potential folder to add the entry to.
$entry_id Integer
The entry ID.
$current_step Gravity_Flow_Step
The current step for this entry.

Examples

Example 1 - Compare entry field value against folder names?

add_filter( 'gravityflowfolders_folder_match_add_step', 'folders_execgroup_match', 10,  4 );
function folders_execgroup_match( $match, $folder, $entry_id, $step ) {
	// Ensure it only executes on a specific step.
	if( $step->get_id() !== 40 ) {
		return $match;
	}
		
	$entry = GFAPI::get_entry( $entry_id );	
	// Compare entry field #3 value to the folder name
	if( $entry && $folder->get_name() == $entry['3'] ) {	
		$match = true;
	} else {
		$match = false;
	}
	
	return $match;
}

Placement

This code should be placed in the functions.php file of your active theme or in a custom functions plugin.