GravityView  2.17
The best, easiest way to display Gravity Forms entries on your website.
field-checkbox-html.php
Go to the documentation of this file.
1 <?php
2 /**
3  * The default checkbox field output template.
4  *
5  * @global \GV\Template_Context $gravityview
6  * @since 2.0
7  */
8 if ( ! isset( $gravityview ) || empty( $gravityview->template ) ) {
9  gravityview()->log->error( '{file} template loaded without context', array( 'file' => __FILE__ ) );
10  return;
11 }
12 
13 $field_id = $gravityview->field->ID;
14 $field = $gravityview->field->field;
15 $value = $gravityview->value;
16 $form = $gravityview->view->form->form;
17 $display_value = $gravityview->display_value;
18 $entry = $gravityview->entry->as_entry();
19 $field_settings = $gravityview->field->as_configuration();
20 
21 $is_single_input = floor( $field_id ) !== floatval( $field_id );
22 
23 $output = '';
24 
25 if ( ! $is_single_input ) {
27 } else {
28 
29  $display_type = \GV\Utils::get( $field_settings, 'choice_display' );
30 
32 
33  switch ( $display_type ) {
34  case 'value':
36  break;
37  case 'label':
39  break;
40  case 'tick':
41  default: // Backward compatibility
42  if ( '' !== $field_value ) {
43  /**
44  * @filter `gravityview_field_tick` Change the output for a checkbox "check" symbol. Default is the "dashicons-yes" icon
45  * @see https://developer.wordpress.org/resource/dashicons/#yes
46  *
47  * @param string $output HTML span with `dashicons dashicons-yes` class
48  * @param array $entry Gravity Forms entry array
49  * @param array $field GravityView field array
50  *
51  * @since 2.0
52  * @param \GV\Template_Context The template context.
53  */
54  $output = apply_filters( 'gravityview_field_tick', '<span class="dashicons dashicons-yes"></span>', $entry, $field, $gravityview );
55  }
56  break;
57  }
58 
59 }
60 
61 echo $output;
gravityview_get_field_label( $form, $field_id, $field_value='')
Retrieve the label of a given field id (for a specific form)
gravityview_get_field_value( $entry, $field_id, $display_value)
Handle getting values for complex Gravity Forms fields.
Definition: class-api.php:1034
if(! isset( $gravityview)||empty( $gravityview->template)) $field_id
The default checkbox field output template.
$is_single_input
$display_type
Definition: radio.php:13
static get( $array, $key, $default=null)
Grab a value from an array or an object or default.
gravityview()
The main GravityView wrapper function.