Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Replace the Gravity Flow {workflow_cancel_link} merge tag when used in the step instructions.
add_filter( 'gform_pre_replace_merge_tags', function ( $text, $form, $entry ) {
if ( strpos( $text, '{workflow_cancel_link}' ) === false || empty( $entry ) || ! class_exists( 'Gravity_Flow_Merge_Tags' ) ) {
return $text;
}
$api = new Gravity_Flow_API( $form['id'] );
$step = $api->get_current_step( $entry );
if ( ! $step ) {
return $text;
}
$assignee_key = $step->get_current_assignee_key();
$args = array(
'assignee' => $step->get_assignee( $assignee_key ),
'step' => $step,
);
$text = Gravity_Flow_Merge_Tags::get( 'workflow_cancel', $args )->replace( $text );
return $text;
}, 9, 3 );
@michaeledi

This comment has been minimized.

Copy link

commented Jul 21, 2017

Hi Richard, the snippet seems not functional anymore, could you please check it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.