GravityView  1.19.4
The best, easiest way to display Gravity Forms entries on your website.
list-body.php
Go to the documentation of this file.
1 <?php
2 /**
3  * @file templates/list-body.php
4  *
5  * Display the entries loop when using a list layout
6  *
7  * @package GravityView
8  * @subpackage GravityView/templates
9  *
10  * @global GravityView_View $this
11  */
12 
13 /**
14  * @action `gravityview_list_body_before` Tap in before the entry loop has been displayed
15  * @param GravityView_View $this The GravityView_View instance
16  */
17 do_action( 'gravityview_list_body_before', $this );
18 
19 // There are no entries.
20 if( ! $this->getTotalEntries() ) {
21 
22  ?>
23  <div class="gv-list-view gv-no-results">
24  <div class="gv-list-view-title">
25  <h3><?php echo gv_no_results(); ?></h3>
26  </div>
27  </div>
28  <?php
29 
30 } elseif( $this->getContextFields() ) {
31 
32  // There are entries. Loop through them.
33  foreach ( $this->getEntries() as $entry ) {
34 
35  $this->setCurrentEntry( $entry );
36 
37  $entry_slug = GravityView_API::get_entry_slug( $entry['id'], $entry );
38  ?>
39 
40  <div id="gv_list_<?php echo esc_attr( $entry_slug ); ?>" class="<?php echo esc_attr( apply_filters( 'gravityview_entry_class', 'gv-list-view', $entry, $this ) ); ?>">
41 
42  <?php
43 
44  /**
45  * @action `gravityview_entry_before` Tap in before the the entry is displayed, inside the entry container
46  * @param array $entry Gravity Forms Entry array
47  * @param GravityView_View $this The GravityView_View instance
48  */
49  do_action( 'gravityview_entry_before', $entry, $this );
50 
51  ?>
52 
53  <?php if ( $this->getField('directory_list-title') || $this->getField('directory_list-subtitle') ) { ?>
54 
55  <?php
56 
57  /**
58  * @action `gravityview_entry_title_before` Tap in before the the entry title is displayed
59  * @param array $entry Gravity Forms Entry array
60  * @param GravityView_View $this The GravityView_View instance
61  */
62  do_action( 'gravityview_entry_title_before', $entry, $this );
63 
64  ?>
65  <div class="gv-list-view-title">
66 
67  <?php if ( $this->getField('directory_list-title') ) {
68  $i = 0;
69  $title_args = array(
70  'entry' => $entry,
71  'form' => $this->getForm(),
72  'hide_empty' => $this->getAtts( 'hide_empty' ),
73  );
74 
75  foreach ( $this->getField( 'directory_list-title' ) as $field ) {
76  $title_args['field'] = $field;
77 
78  // The first field in the title zone is the main
79  if ( $i == 0 ) {
80  $title_args['markup'] = '<h3 class="{{class}}">{{label}}{{value}}</h3>';
81  echo gravityview_field_output( $title_args );
82  unset( $title_args['markup'] );
83  } else {
84  $title_args['wpautop'] = true;
85  echo gravityview_field_output( $title_args );
86  }
87 
88  $i ++;
89  }
90  }
91 
92  $this->renderZone('subtitle', array(
93  'markup' => '<h4 id="{{ field_id }}" class="{{class}}">{{label}}{{value}}</h4>',
94  'wrapper_class' => 'gv-list-view-subtitle',
95  ));
96  ?>
97  </div>
98 
99  <?php
100 
101  /**
102  * @action `gravityview_entry_title_after` Tap in after the title block
103  * @param array $entry Gravity Forms Entry array
104  * @param GravityView_View $this The GravityView_View instance
105  */
106  do_action( 'gravityview_entry_title_after', $entry, $this );
107 
108  ?>
109 
110  <?php } ?>
111 
112  <div class="gv-grid gv-list-view-content">
113 
114  <?php
115 
116  /**
117  * @action `gravityview_entry_content_before` Tap in inside the View Content wrapper <div>
118  * @param array $entry Gravity Forms Entry array
119  * @param GravityView_View $this The GravityView_View instance
120  */
121  do_action( 'gravityview_entry_content_before', $entry, $this );
122 
123  $this->renderZone('image', 'wrapper_class="gv-grid-col-1-3 gv-list-view-content-image"');
124 
125  $this->renderZone('description', array(
126  'wrapper_class' => 'gv-grid-col-2-3 gv-list-view-content-description',
127  'label_markup' => '<h4>{{label}}</h4>',
128  'wpautop' => true
129  ));
130 
131  $this->renderZone('content-attributes', array(
132  'wrapper_class' => 'gv-list-view-content-attributes',
133  'markup' => '<p id="{{ field_id }}" class="{{class}}">{{label}}{{value}}</p>'
134  ));
135 
136  /**
137  * @action `gravityview_entry_content_after` Tap in at the end of the View Content wrapper <div>
138  * @param array $entry Gravity Forms Entry array
139  * @param GravityView_View $this The GravityView_View instance
140  */
141  do_action( 'gravityview_entry_content_after', $entry, $this );
142 
143  ?>
144 
145  </div>
146 
147  <?php
148 
149  // Is the footer configured?
150  if ( $this->getField('directory_list-footer-left') || $this->getField('directory_list-footer-right') ) {
151 
152  /**
153  * @action `gravityview_entry_footer_before` Tap in before the footer wrapper
154  * @param array $entry Gravity Forms Entry array
155  * @param GravityView_View $this The GravityView_View instance
156  */
157  do_action( 'gravityview_entry_footer_before', $entry, $this );
158 
159  ?>
160 
161  <div class="gv-grid gv-list-view-footer">
162  <div class="gv-grid-col-1-2 gv-left">
163  <?php $this->renderZone('footer-left'); ?>
164  </div>
165 
166  <div class="gv-grid-col-1-2 gv-right">
167  <?php $this->renderZone('footer-right'); ?>
168  </div>
169  </div>
170 
171  <?php
172 
173  /**
174  * @action `gravityview_entry_footer_after` Tap in after the footer wrapper
175  * @param array $entry Gravity Forms Entry array
176  * @param GravityView_View $this The GravityView_View instance
177  */
178  do_action( 'gravityview_entry_footer_after', $entry, $this );
179 
180  } // End if footer is configured
181 
182 
183  /**
184  * @action `gravityview_entry_after` Tap in after the entry has been displayed, but before the container is closed
185  * @param array $entry Gravity Forms Entry array
186  * @param GravityView_View $this The GravityView_View instance
187  */
188  do_action( 'gravityview_entry_after', $entry, $this );
189 
190  ?>
191 
192  </div>
193 
194  <?php }
195 
196 } // End if has entries
197 
198 /**
199  * @action `gravityview_list_body_after` Tap in after the entry loop has been displayed
200  * @param GravityView_View $this The GravityView_View instance
201  */
202 do_action( 'gravityview_list_body_after', $this );
gravityview_field_output($passed_args)
Output field based on a certain html markup.
Definition: class-api.php:1148
gv_no_results($wpautop=true)
Definition: class-api.php:805
$entry_slug
Definition: notes.php:30
$entry
Definition: notes.php:27
static get_entry_slug($id_or_string, $entry=array())
Get the entry slug for the entry.
Definition: class-api.php:567
$field
Definition: gquiz_grade.php:11