15 public $icon =
'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyMS43IDExLjIiPjxwYXRoIGQ9Ik0xNC43IDUuOWwtNy00Yy0xLjItLjctMi41LS44LTMuNy0uMy0xLjcuNy0yLjYgMS45LTIuNyAzLjYtLjEgMS41LjQgMi43IDEuNCAzLjcgMS4xIDEuMSAyLjYgMS40IDQuMy45LjIgMCAuNS0uMiAxLjEtLjQuMi0uMS4zLS4xLjQtLjEuMyAwIC41LjEuNi40LjEuMyAwIC41LS4zLjctMS4yLjctMi40LjktMy44LjgtMS4zLS4yLTIuNS0uNy0zLjQtMS42Qy41IDguNS0uMSA3LjEgMCA1LjVjLjEtMi40IDEuMi00IDMuMy01QzQuNS0uMSA1LjgtLjIgNy4yLjJjLjIuMS42LjIgMS4yLjZsNyAzLjkuNC0uNi44IDIuMS0yLjIuMy4zLS42em0tNy44LS41bDcgNGMxLjIuNyAyLjUuOCAzLjcuMyAxLjctLjcgMi42LTEuOSAyLjgtMy42LjEtMS40LS40LTIuNi0xLjUtMy43cy0yLjUtMS40LTQuMy0xYy0uNC4xLS44LjMtMS4xLjRsLS40LjFjLS4zIDAtLjUtLjEtLjYtLjQtLjEtLjMgMC0uNS4zLS43IDEuMS0uNyAyLjQtLjkgMy44LS44IDEuNC4yIDIuNS43IDMuNCAxLjcgMS4yIDEuMiAxLjcgMi41IDEuNiA0LjEtLjEgMi4zLTEuMiA0LTMuMyA1LTEuNC42LTIuNy42LTMuOS4yLS4zLS4xLS43LS4zLTEuMS0uNWwtNy0zLjktLjQuNUw1LjEgNWwyLjItLjMtLjQuN3oiLz48L3N2Zz4=';
18 $this->label = esc_html__(
'Workflow Step',
'gk-gravityview' );
23 parent::__construct();
28 add_filter(
'gravityview_search_field_label', array( $this,
'modify_gravityview_search_field_step_label' ), 10, 3 );
30 add_filter(
'gravityview_widget_search_filters', array( $this,
'modify_frontend_search_fields' ), 10, 3 );
32 add_filter(
'gravityview_field_entry_value_workflow_step', array( $this,
'modify_entry_value_workflow_step' ), 10, 4 );
52 $has_workflow_step = isset(
$entry[
'workflow_step'] );
54 if( $has_workflow_step ) {
56 $GFlow =
new Gravity_Flow_API(
$entry[
'form_id'] );
58 if ( $current_step = $GFlow->get_current_step(
$entry ) ) {
59 $output = esc_html( $current_step->get_name() );
61 $output = esc_html__(
'Workflow Complete',
'gk-gravityview' );
79 $workflow_step_id =
false;
81 preg_match(
'/workflow_step_status_(\d+)/', $key, $matches );
83 if ( ! empty( $matches ) ) {
84 $workflow_step_id = intval( $matches[1] );
87 return $workflow_step_id;
107 $return = esc_html( $step->get_label() );
129 $GFlow =
new Gravity_Flow_API(
$form_id );
131 $workflow_step = $GFlow->get_step( $workflow_step_id );
133 if( ! $GFlow || ! $workflow_step ) {
137 return $workflow_step;
155 if ( $this->name === $search_field[
'key'] ) {
159 $workflow_steps = gravity_flow()->get_steps(
$form_id );
163 foreach ( $workflow_steps as $step ) {
165 'text' => $step->get_name(),
166 'value' => $step->get_id(),
170 $search_field[
'choices'] = $choices;
176 $status_key = sprintf(
'workflow_step_status_%d', $workflow_step_id );
182 return $search_fields;
Modify field settings by extending this class.
new GravityView_Field_Workflow_Step
modify_gravityview_search_field_step_label( $label='', $gf_field=null, $field=array())
static getInstance( $passed_post=NULL)
modify_frontend_search_fields( $search_fields=array(), GravityView_Widget_Search $widget=null, $widget_args=array())
Set the search field choices to the Steps available for the current form.
$field_settings['content']
static get_status_options( $form_id=0, $status_key='workflow_final_status')
Get the available status choices from Gravity Flow.
modify_entry_value_workflow_step( $output, $entry, $field_settings, $field)
Get the value of the Workflow Step based on the workflow_step entry meta int value.
get_step_id_from_key( $key)
Get the Workflow Step ID from a search field key.
if(empty( $created_by)) $form_id
get_workflow_step( $workflow_step_id=0)
Get a Gravity_Flow_Step object from the step ID.