GravityView  2.1.1
The best, easiest way to display Gravity Forms entries on your website.
time.php
Go to the documentation of this file.
1 <?php
2 /**
3  * Display the time field type
4  *
5  * @package GravityView
6  * @subpackage GravityView/templates/fields
7  */
8 
10 
11 $gv_field = $gravityview_view->getCurrentField();
12 
13 /** @var string $value Raw time value */
14 $value = \GV\Utils::_GET( 'value', \GV\Utils::get( $gv_field, 'value' ) );
15 
16 /** @var string $field_id ID of the field being displayed */
17 $field_id = \GV\Utils::_GET( 'field_id', \GV\Utils::get( $gv_field, 'field_id' ) );
18 
19 $output = '';
20 
21 if( '' !== $value ) {
22 
23  /** @var GF_Field_Time $field Gravity Forms Time field */
24  $field = \GV\Utils::_GET( 'field', \GV\Utils::get( $gv_field, 'field' ) );
25 
26  $format = $gravityview_view->getCurrentFieldSetting( 'date_display' );
27 
28  if ( empty( $format ) ) {
29 
30  $field->sanitize_settings();
31 
33  }
34 
35  // If there is a custom PHP date format passed via the date_display setting, use PHP's date format
36  $output = date_i18n( $format, strtotime( $value ) );
37 }
38 
39 echo $output;
$value
Definition: time.php:14
static _GET( $name, $default=null)
Grab a value from the _GET superglobal or default.
static getInstance( $passed_post=NULL)
if(gv_empty( $field['value'], false, false)) $format
$output
Definition: time.php:19
get( $key, $default=null)
Retrieve a setting.
$gv_field
Definition: time.php:11
$field_id
Definition: time.php:17
$gravityview_view
Definition: time.php:9
static date_format( $time_format='12', $field_id=0)
Get the default date format for a field based on the field ID and the time format setting...
$field
Definition: gquiz_grade.php:11