GravityView  2.17
The best, easiest way to display Gravity Forms entries on your website.
field-gquiz_percent-html.php
Go to the documentation of this file.
1 <?php
2 /**
3  * The default quiz percentage 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 $display_value = $gravityview->display_value;
15 
16 // If there's no grade, don't continue
17 if ( gv_empty( $display_value, false, false ) ) {
18  return;
19 }
20 
21 /**
22  * @filter `gravityview/field/quiz_percent/format` Modify the format of the display of Quiz Score (Percent) field.
23  * @see http://php.net/manual/en/function.sprintf.php For formatting guide
24  * @param string $format Format passed to printf() function. Default `%d%%`, which prints as "{number}%". Notice the double `%%`, this prints a literal '%' character.
25  * @since 2.0
26  * @param \GV\Template_Context $gravityview The context.
27  */
28 $format = apply_filters('gravityview/field/quiz_percent/format', '%d%%', $gravityview );
29 
30 printf( $format, $display_value );
if(gv_empty( $display_value, false, false)) $format
gravityview()
The main GravityView wrapper function.
gv_empty( $value, $zero_is_empty=true, $allow_string_booleans=true)
Is the value empty?
if(! isset( $gravityview)||empty( $gravityview->template)) $display_value
The default quiz percentage field output template.