gravityflow_admin_actions_workflow_detail

The gravityflow_admin_actions_workflow_detail filter can be used to add or remove choices from the admin actions drop down on the workflow detail page.

Parameters

$admin_actions  boolean

Defaults to true.

$current_step  boolean|Gravity_Flow_Step

The current step.

$steps Gravity_Flow_Step[]

An array of steps for the current form.

$form  Form Object

The current form.

$entry  Entry Object

The current entry.

Examples

Example 1

The following example shows how you can add a new choice to the admin actions drop down

add_filter( 'gravityflow_admin_actions_workflow_detail', 'filter_admin_actions_workflow_detail', 10, 5 );
function filter_admin_actions_workflow_detail( $admin_actions, $current_step, $steps, $form, $entry ) {
    $admin_actions[] = array( 'label' => 'your new action', 'value' => 'your_new_action' );

    return $admin_actions;
}

Example 2

The following example shows how you can add a new choice to the admin actions drop down limited to display on completed entries.

add_filter( 'gravityflow_admin_actions_workflow_detail', 'filter_admin_actions_workflow_detail', 10, 5 );
function filter_admin_actions_workflow_detail( $admin_actions, $current_step, $steps, $form, $entry ) {
	if( gform_get_meta( $entry['id'], 'workflow_final_status' ) == 'complete') {
		$admin_actions[] = array( 'label' => 'Cancel Completed Workflow', 'value' => 'sh_cancel_completed_workflow' );
	}
	return $admin_actions;
}

Example 3

The following example shows how you can add a new optgroup to the admin actions drop down

add_filter( 'gravityflow_admin_actions_workflow_detail', 'admin_actions_add_optgroup', 10, 5 );
function admin_actions_add_optgroup( $admin_actions, $current_step, $steps, $form, $entry ) {
   $admin_actions[] = array(
      'label'   => esc_html__( 'Your custom optgroup:', 'gravityflow' ),
      'choices' => array(
         array(
            'label' => 'Choice 1',
            'value' => 'custom_optgroup|choice_1'
         ),
         array(
            'label' => 'Choice 2',
            'value' => 'custom_optgroup|choice_2'
         ),
      )
   );

   return $admin_actions;
}