GravityView  2.17
The best, easiest way to display Gravity Forms entries on your website.
class-gravityview-field-workflow_current_status_timestamp.php
Go to the documentation of this file.
1 <?php
2 /**
3  * @file class-gravityview-field-workflow_current_status_timestamp.php
4  * @since develop
5  * @package GravityView
6  * @subpackage includes\fields
7  */
8 
10 
11  var $name = 'workflow_current_status_timestamp';
12 
13  public $group = 'add-ons';
14 
15  var $contexts = array( 'multiple', 'single' );
16 
17  var $entry_meta_key = 'workflow_current_status_timestamp';
18 
19  var $is_numeric = true;
20 
21  public $icon = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyMS43IDExLjIiPjxwYXRoIGQ9Ik0xNC43IDUuOWwtNy00Yy0xLjItLjctMi41LS44LTMuNy0uMy0xLjcuNy0yLjYgMS45LTIuNyAzLjYtLjEgMS41LjQgMi43IDEuNCAzLjcgMS4xIDEuMSAyLjYgMS40IDQuMy45LjIgMCAuNS0uMiAxLjEtLjQuMi0uMS4zLS4xLjQtLjEuMyAwIC41LjEuNi40LjEuMyAwIC41LS4zLjctMS4yLjctMi40LjktMy44LjgtMS4zLS4yLTIuNS0uNy0zLjQtMS42Qy41IDguNS0uMSA3LjEgMCA1LjVjLjEtMi40IDEuMi00IDMuMy01QzQuNS0uMSA1LjgtLjIgNy4yLjJjLjIuMS42LjIgMS4yLjZsNyAzLjkuNC0uNi44IDIuMS0yLjIuMy4zLS42em0tNy44LS41bDcgNGMxLjIuNyAyLjUuOCAzLjcuMyAxLjctLjcgMi42LTEuOSAyLjgtMy42LjEtMS40LS40LTIuNi0xLjUtMy43cy0yLjUtMS40LTQuMy0xYy0uNC4xLS44LjMtMS4xLjRsLS40LjFjLS4zIDAtLjUtLjEtLjYtLjQtLjEtLjMgMC0uNS4zLS43IDEuMS0uNyAyLjQtLjkgMy44LS44IDEuNC4yIDIuNS43IDMuNCAxLjcgMS4yIDEuMiAxLjcgMi41IDEuNiA0LjEtLjEgMi4zLTEuMiA0LTMuMyA1LTEuNC42LTIuNy42LTMuOS4yLS4zLS4xLS43LS4zLTEuMS0uNWwtNy0zLjktLjQuNUw1LjEgNWwyLjItLjMtLjQuN3oiLz48L3N2Zz4=';
22 
23  public function __construct() {
24  $this->label = esc_html__( 'Workflow Current Status Timestamp', 'gk-gravityview' );
25  $this->add_hooks();
26  parent::__construct();
27  }
28 
29  function add_hooks() {
30  add_filter( 'gravityview_field_entry_value_workflow_current_status_timestamp', array( $this, 'modify_entry_value_workflow_current_status_timestamp' ), 10, 4 );
31  }
32 
33  /**
34  * Convert a timestamp into a nice format.
35  *
36  * @param string $output HTML value output
37  * @param array $entry The GF entry array
38  * @param array $field_settings Settings for the particular GV field,
39  * @param array $field Current field being displayed
40  *
41  * @since 1.17
42  *
43  * @return string If Gravity Flow not found, or entry not processed yet, returns initial value. Otherwise, returns name of workflow step.
44  */
46  $timestamp = gform_get_meta( $entry['id'], 'workflow_current_status_timestamp' );
47 
48  if ( ! $timestamp ) {
49  return $timestamp;
50  }
51 
52  return GVCommon::format_date( date( 'Y-m-d H:i:s', $timestamp ), 'format=' . \GV\Utils::get( $field_settings, 'date_display' ) );
53  }
54 
55  public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) {
56  if ( $context == 'edit' ) {
57  return $field_options;
58  }
59 
60  $this->add_field_support( 'date_display', $field_options );
61 
62  return $field_options;
63  }
64 }
65 
Modify field settings by extending this class.
$field_settings['content']
Definition: custom.php:27
add_field_support( $key, &$field_options)
field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id)
static format_date( $date_string='', $args=array())
Allow formatting date and time based on GravityView standards.
if(empty( $created_by)) $form_id
$entry
Definition: notes.php:27
if(false !==strpos( $value, '00:00')) $field_id
string $field_id ID of the field being displayed
Definition: time.php:22
modify_entry_value_workflow_current_status_timestamp( $output, $entry, $field_settings, $field)
Convert a timestamp into a nice format.