GravityView  2.17
The best, easiest way to display Gravity Forms entries on your website.
deprecated/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  if (
113  ( $this->getFields( 'directory_list-image' ) || $this->getFields( 'directory_list-description' ) || $this->getFields( 'directory_list-content-attributes' ) )
114  || has_action( 'gravityview_entry_content_before' ) || has_action( 'gravityview_entry_content_after' )
115  ) { ?>
116 
117  <div class="gv-grid gv-list-view-content">
118 
119  <?php
120 
121  /**
122  * @action `gravityview_entry_content_before` Tap in inside the View Content wrapper <div>
123  *
124  * @param array $entry Gravity Forms Entry array
125  * @param \GravityView_View $this The GravityView_View instance
126  */
127  do_action( 'gravityview_entry_content_before', $entry, $this );
128 
129  $this->renderZone( 'image', 'wrapper_class="gv-grid-col-1-3 gv-list-view-content-image"' );
130 
131  $this->renderZone( 'description', array(
132  'wrapper_class' => 'gv-grid-col-2-3 gv-list-view-content-description',
133  'label_markup' => '<h4>{{label}}</h4>',
134  'wpautop' => true
135  ) );
136 
137  $this->renderZone( 'content-attributes', array(
138  'wrapper_class' => 'gv-list-view-content-attributes',
139  'markup' => '<p id="{{ field_id }}" class="{{class}}">{{label}}{{value}}</p>'
140  ) );
141 
142  /**
143  * @action `gravityview_entry_content_after` Tap in at the end of the View Content wrapper <div>
144  *
145  * @param array $entry Gravity Forms Entry array
146  * @param \GravityView_View $this The GravityView_View instance
147  */
148  do_action( 'gravityview_entry_content_after', $entry, $this );
149 
150  ?>
151 
152  </div>
153 
154  <?php
155  }
156 
157  // Is the footer configured?
158  if ( $this->getField('directory_list-footer-left') || $this->getField('directory_list-footer-right') ) {
159 
160  /**
161  * @action `gravityview_entry_footer_before` Tap in before the footer wrapper
162  * @param array $entry Gravity Forms Entry array
163  * @param \GravityView_View $this The GravityView_View instance
164  */
165  do_action( 'gravityview_entry_footer_before', $entry, $this );
166 
167  ?>
168 
169  <div class="gv-grid gv-list-view-footer">
170  <div class="gv-grid-col-1-2 gv-left">
171  <?php $this->renderZone('footer-left'); ?>
172  </div>
173 
174  <div class="gv-grid-col-1-2 gv-right">
175  <?php $this->renderZone('footer-right'); ?>
176  </div>
177  </div>
178 
179  <?php
180 
181  /**
182  * @action `gravityview_entry_footer_after` Tap in after the footer wrapper
183  * @param array $entry Gravity Forms Entry array
184  * @param \GravityView_View $this The GravityView_View instance
185  */
186  do_action( 'gravityview_entry_footer_after', $entry, $this );
187 
188  } // End if footer is configured
189 
190 
191  /**
192  * @action `gravityview_entry_after` Tap in after the entry has been displayed, but before the container is closed
193  * @param array $entry Gravity Forms Entry array
194  * @param \GravityView_View $this The GravityView_View instance
195  */
196  do_action( 'gravityview_entry_after', $entry, $this );
197 
198  ?>
199 
200  </div>
201 
202  <?php }
203 
204 } // End if has entries
205 
206 /**
207  * @action `gravityview_list_body_after` Tap in after the entry loop has been displayed
208  * @param \GravityView_View $this The GravityView_View instance
209  */
210 do_action( 'gravityview_list_body_after', $this );
gv_no_results( $wpautop=true, $context=null)
Definition: class-api.php:942
static get_entry_slug( $id_or_string, $entry=array())
Get the entry slug for the entry.
Definition: class-api.php:550
$entry_slug
Definition: notes.php:30
gravityview_field_output( $passed_args, $context=null)
Output field based on a certain html markup.
Definition: class-api.php:1452
$entry
Definition: notes.php:27