gravityflow_workflow_detail_display_field

Use this filter to hide specific fields on the workflow detail page.

Example 1 - Hide a specific field when on a specific step.

// Hide field ID 4 when on step ID 88 add_filter( 'gravityflow_workflow_detail_display_field', 'sh_gravityflow_workflow_detail_display_field', 10, 5 ); function sh_gravityflow_workflow_detail_display_field( $display, $field, $form, $entry, $current_step ) < if ( $current_step && $current_step->get_id() == 88 && $field->id == 4 ) < $display = false; >return $display; >

Example 2 - Hide all fields on Form 1 except fields 4, 5, and 6.

// Hide all fields except fields 4 on Form 1 add_filter( 'gravityflow_workflow_detail_display_field', 'sh_gravityflow_workflow_detail_display_field', 10, 5 ); function sh_gravityflow_workflow_detail_display_field( $display, $field, $form, $entry, $current_step ) < if ( $form['id'] == 1 ) < if ( in_array( $field->id, array( 4, 5, 6 ) ) ) < $display = true; >else < $display = false; >> return $display; >

Example 3 - Conditionally display certain fields based on overall workflow and certain step statuses.

This example will display all fields (field ID 1 - 4 assumed) if workflow steps id 256 and 257 are complete and the workflow is complete. If step 257 were rejected / skipped via Admin actions only filed ids 1 and 2 will be displayed on workflow complete status.
If the workflow is not complete it will return whatever value has been defined in step settings (including the complete step settings).

add_filter( 'gravityflow_workflow_detail_display_field', 'sh_gravityflow_workflow_detail_display_field', 10, 5 ); function sh_gravityflow_workflow_detail_display_field( $display, $field, $form, $entry, $current_step ) < if ( $entry['workflow_final_status'] == 'complete' ) < if ( $entry['workflow_step_status_256'] == 'complete' && $entry['workflow_step_status_257'] == 'complete') < $display = true; >else if ( $entry['workflow_step_status_256'] == 'complete' ) < if ( in_array( $field->id, array( 1, 2 ) ) ) < $display = true; >else < $display = false; >> > return $display; >

Placement

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

Last updated on December 30, 2020

Categories