GravityView  2.17
The best, easiest way to display Gravity Forms entries on your website.
field-number-html.php
Go to the documentation of this file.
1 <?php
2 /**
3  * The default number field output template.
4  *
5  * @global \GV\Template_Context $gravityview
6  * @since 2.0
7  */
8 
9 if ( ! isset( $gravityview ) || empty( $gravityview->template ) ) {
10  gravityview()->log->error( '{file} template loaded without context', array( 'file' => __FILE__ ) );
11  return;
12 }
13 
14 $value = $gravityview->value;
15 $form = $gravityview->view->form->form;
16 $display_value = $gravityview->display_value;
17 $field_settings = $gravityview->field->as_configuration();
18 
19 if ( $value !== '' ) {
20  $decimals = ( isset( $field_settings['decimals'] ) && $field_settings['decimals'] !== '' ) ? $field_settings['decimals'] : '';
21  if ( empty( $field_settings['number_format'] ) && $gravityview->field->field->numberFormat === 'currency' ) {
22  echo $display_value;
23  } else {
24  echo gravityview_number_format( $value, $decimals, ! empty( $field_settings['number_format'] ) );
25  }
26 } else {
27  echo $display_value;
28 }
$display_value
$field_settings
if(! isset( $gravityview)||empty( $gravityview->template)) $value
The default number field output template.
gravityview()
The main GravityView wrapper function.
gravityview_number_format( $number, $decimals='', $separator=true)
Intelligently format a number.