Skip to content

Instantly share code, notes, and snippets.

@richardW8k
Last active July 30, 2019 10:06
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save richardW8k/8d982aab66ace32a5e0d35ec7e2d6c1b to your computer and use it in GitHub Desktop.
Save richardW8k/8d982aab66ace32a5e0d35ec7e2d6c1b to your computer and use it in GitHub Desktop.
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
Copy link

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