GravityView  2.17
The best, easiest way to display Gravity Forms entries on your website.
field-gquiz_score-html.php
Go to the documentation of this file.
1 <?php
2 /**
3  * The default quiz score 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 $form = $gravityview->view->form->form;
16 $field_settings = $gravityview->field->as_configuration();
17 
18 // If there's no grade, don't continue
19 if ( gv_empty( $display_value, false, false ) ) {
20  return;
21 }
22 
23 if ( class_exists('GFQuiz') && $field_settings['quiz_use_max_score'] ) {
24 
25  $max_score = GFQuiz::get_instance()->get_max_score( $form );
26 
27  printf( '%d/%d', $display_value, $max_score );
28 
29 } else {
30 
31  echo $display_value;
32 
33 }
if(! isset( $gravityview)||empty( $gravityview->template)) $display_value
The default quiz score field output template.
gravityview()
The main GravityView wrapper function.
gv_empty( $value, $zero_is_empty=true, $allow_string_booleans=true)
Is the value empty?