Last active
July 30, 2019 10:06
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi Richard, the snippet seems not functional anymore, could you please check it?