GravityView  2.17
The best, easiest way to display Gravity Forms entries on your website.
class-gravityview-field-workflow_final_status.php
Go to the documentation of this file.
1 <?php
2 /**
3  * @file class-gravityview-field-workflow_final_status.php
4  * @since 1.17.2
5  * @package GravityView
6  * @subpackage includes\fields
7  */
8 
10 
11  public $name = 'workflow_final_status';
12 
13  public $group = 'add-ons';
14 
15  public $icon = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyMS43IDExLjIiPjxwYXRoIGQ9Ik0xNC43IDUuOWwtNy00Yy0xLjItLjctMi41LS44LTMuNy0uMy0xLjcuNy0yLjYgMS45LTIuNyAzLjYtLjEgMS41LjQgMi43IDEuNCAzLjcgMS4xIDEuMSAyLjYgMS40IDQuMy45LjIgMCAuNS0uMiAxLjEtLjQuMi0uMS4zLS4xLjQtLjEuMyAwIC41LjEuNi40LjEuMyAwIC41LS4zLjctMS4yLjctMi40LjktMy44LjgtMS4zLS4yLTIuNS0uNy0zLjQtMS42Qy41IDguNS0uMSA3LjEgMCA1LjVjLjEtMi40IDEuMi00IDMuMy01QzQuNS0uMSA1LjgtLjIgNy4yLjJjLjIuMS42LjIgMS4yLjZsNyAzLjkuNC0uNi44IDIuMS0yLjIuMy4zLS42em0tNy44LS41bDcgNGMxLjIuNyAyLjUuOCAzLjcuMyAxLjctLjcgMi42LTEuOSAyLjgtMy42LjEtMS40LS40LTIuNi0xLjUtMy43cy0yLjUtMS40LTQuMy0xYy0uNC4xLS44LjMtMS4xLjRsLS40LjFjLS4zIDAtLjUtLjEtLjYtLjQtLjEtLjMgMC0uNS4zLS43IDEuMS0uNyAyLjQtLjkgMy44LS44IDEuNC4yIDIuNS43IDMuNCAxLjcgMS4yIDEuMiAxLjcgMi41IDEuNiA0LjEtLjEgMi4zLTEuMiA0LTMuMyA1LTEuNC42LTIuNy42LTMuOS4yLS4zLS4xLS43LS4zLTEuMS0uNWwtNy0zLjktLjQuNUw1LjEgNWwyLjItLjMtLjQuN3oiLz48L3N2Zz4=';
16 
17  public function __construct() {
18  $this->label = esc_html__( 'Workflow Status', 'gk-gravityview' );
19  $this->default_search_label = $this->label;
20  $this->add_hooks();
21  parent::__construct();
22  }
23 
24  function add_hooks() {
25  add_filter( 'gravityview_widget_search_filters', array( $this, 'modify_search_filters' ), 10, 3 );
26 
27  add_filter( 'gravityview_field_entry_value_workflow_final_status', array( $this, 'modify_entry_value_workflow_final_status' ), 10, 4 );
28  }
29 
30  /**
31  * Convert the status key with the full status label. Uses custom labels, if set.
32  *
33  * @uses Gravity_Flow::translate_status_label()
34  *
35  * @param string $output HTML value output
36  * @param array $entry The GF entry array
37  * @param array $field_settings Settings for the particular GV field
38  * @param array $field Current field being displayed
39  *
40  * @since 1.17
41  *
42  * @return string If Gravity Flow not found, or entry not processed yet, returns initial value. Otherwise, returns name of workflow step.
43  */
45 
46  if( ! empty( $output ) ) {
47  $output = gravity_flow()->translate_status_label( $output );
48  }
49 
50  return $output;
51  }
52 
53 
54  /**
55  * Populate the Final Status Search Bar field dropdown with all the statuses in Gravity Flow
56  *
57  * @since 1.17.3
58  *
59  * @param array $search_fields
60  * @param GravityView_Widget_Search|null $widget
61  * @param array $widget_args
62  *
63  * @return array
64  */
65  function modify_search_filters( $search_fields = array(), GravityView_Widget_Search $widget = null, $widget_args = array() ) {
66 
67  foreach ( $search_fields as & $search_field ) {
68  if ( $this->name === \GV\Utils::get( $search_field, 'key' ) ) {
70  }
71  }
72 
73  return $search_fields;
74  }
75 
76 }
77 
Modify field settings by extending this class.
$field_settings['content']
Definition: custom.php:27
modify_search_filters( $search_fields=array(), GravityView_Widget_Search $widget=null, $widget_args=array())
Populate the Final Status Search Bar field dropdown with all the statuses in Gravity Flow...
modify_entry_value_workflow_final_status( $output, $entry, $field_settings, $field)
Convert the status key with the full status label.
static get_status_options( $form_id=0, $status_key='workflow_final_status')
Get the available status choices from Gravity Flow.
$entry
Definition: notes.php:27