Completed
Push — develop ( 7592b8...3eb7c5 )
by Zack
14:44
created

fields/class-gravityview-field-gquiz_score.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/**
3
 * @file class-gravityview-field-gquiz_score.php
4
 * @package GravityView
5
 * @subpackage includes\fields
6
 */
7
8
class GravityView_Field_Quiz_Score extends GravityView_Field {
9
10
	var $name = 'quiz_score';
11
12
	var $group = 'advanced';
0 ignored issues
show
The visibility should be declared for property $group.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
13
14
	var $is_searchable = true;
15
16
	var $search_operators = array( 'is', 'isnot', 'greater_than', 'less_than' );
17
18
	public function __construct() {
19
		$this->label = esc_html__( 'Quiz Score', 'gravityview' );
20
		parent::__construct();
21
	}
22
23
	function field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
24
25
		if( 'edit' === $context ) {
26
			return $field_options;
27
		}
28
29
		$new_fields = array(
30
			'quiz_use_max_score' => array(
31
				'type' => 'checkbox',
32
				'label' => __( 'Show Max Score?', 'gravityview' ),
33
				'desc' => __('Display score as the a fraction: "[score]/[max score]". If unchecked, will display score.', 'gravityview'),
34
				'value' => true,
35
				'merge_tags' => false,
36
			),
37
		);
38
39
		return $new_fields + $field_options;
40
	}
41
42
}
43
44
new GravityView_Field_Quiz_Score;
45