GravityView  2.17
The best, easiest way to display Gravity Forms entries on your website.
field-select-html.php
Go to the documentation of this file.
1 <?php
2 /**
3  * The default select 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 $field = $gravityview->field->field;
15 $display_value = $gravityview->display_value;
16 $entry = $gravityview->entry->as_entry();
17 $field_settings = $gravityview->field->as_configuration();
18 
19 /**
20  * @filter `gravityview/fields/select/output_label` Override whether to show the value or the label of a Select field
21  * @since 1.5.2
22  * @param bool $show_label True: Show the label of the Choice; False: show the value of the Choice. Default: `false`
23  * @param array $entry GF Entry
24  * @param GF_Field_Select $field Gravity Forms Select field
25  * @since 2.0
26  * @param \GV\Template_Context $gravityview The context
27  */
28 $show_label = apply_filters( 'gravityview/fields/select/output_label', ( 'label' === \GV\Utils::get( $field_settings, 'choice_display' ) ), $entry, $field, $gravityview );
29 
30 if ( $show_label && ! empty( $field->choices ) && is_array( $field->choices ) && '' !== $display_value ) {
31  $output = RGFormsModel::get_choice_text( $field, $display_value );
32 } else {
34 }
35 
36 echo $output;
$display_value
if(! isset( $gravityview)||empty( $gravityview->template)) $field
The default select field output template.
$field_settings
gravityview()
The main GravityView wrapper function.