GravityView  2.17
The best, easiest way to display Gravity Forms entries on your website.
quiz.php
Go to the documentation of this file.
1 <?php
2 /**
3  * Display Gravity Forms Quiz output
4  *
5  * @package GravityView
6  * @subpackage GravityView/templates/fields
7  */
8 
10 
11 $field = $gravityview_view->getCurrentField();
12 
13 // If there's no grade, don't continue
14 if( gv_empty( $field['value'], false, false ) ) {
15  return;
16 }
17 
18 if( ! class_exists('GFQuiz') ) {
19  do_action('gravityview_log_error', __FILE__ . ': GFQuiz class does not exist.' );
20  return;
21 }
22 
23 // Get the setting for show/hide explanation
24 $show_answer = \GV\Utils::get( $field, 'field_settings/quiz_show_explanation' );
25 
26 // Update the quiz field so GF generates the output properly
27 $field['field']->gquizShowAnswerExplanation = ! empty( $show_answer );
28 
29 // Generate the output
30 echo GFQuiz::get_instance()->display_quiz_on_entry_detail( $field['value'], $field['field'], $field['entry'], $field['form'] );
static getInstance( $passed_post=NULL)
$field
Definition: quiz.php:11
static get( $array, $key, $default=null)
Grab a value from an array or an object or default.
gv_empty( $value, $zero_is_empty=true, $allow_string_booleans=true)
Is the value empty?
$gravityview_view
Definition: quiz.php:9
if(gv_empty( $field['value'], false, false)) if(! class_exists('GFQuiz')) $show_answer
Definition: quiz.php:24