gravityflow_approval_assignee_status_feedback

The gravityflow_approval_assignee_status_feedback filter allows custom logic to define how an approval step proceeds before the default assignee approve/reject/revert logic takes place. Used in conjunction with gravityflow_approval_assignee_status_type and gravityflow_above_approval_buttons it can enable additional button options (like revert) for processing custom routing of an approval step.

Example #1: Routing to a different step based on status type selection

add_filter( 'gravityflow_approval_assignee_status_feedback', 'approval_review_fields_process', 10, 5 );
function approval_review_fields_process( $feedback, $assignee, $new_status, $form, $current_step ) {
	if ( $current_step->get_type() == 'approval' && $new_status == 'review' ) {
		$current_step->end();
		$note = $current_step->get_name() . ': Review required (' . $current_step->get_label() . ').';
		$current_step->add_note( $note . $current_step->maybe_add_user_note(), true );
		$current_step->start();
		$feedback = esc_html__( 'Review required: (', 'gravityflow' ) . ' ' . $current_step->get_label() . ').';
	}

	return $feedback;
}

Placement

This code should be placed in the functions.php file of your active theme.