GravityView  2.17
The best, easiest way to display Gravity Forms entries on your website.
views/table/table-body.php
Go to the documentation of this file.
1 <?php
2 /**
3  * The entry loop for the table output.
4  *
5  * @global \GV\Template_Context $gravityview
6  */
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 /** @type \GV\View_Table_Template $template */
14 $template = $gravityview->template;
15 
16 if ( 1 === (int) $gravityview->view->settings->get( 'no_entries_options', '0' ) ) {
17  $no_results_css_class = 'gv-no-results gv-no-results-form';
18 } else {
19  $no_results_css_class = 'gv-no-results gv-no-results-text';
20 }
21 
22 ?>
23  <tbody>
24  <?php
25 
26  /** @action `gravityview/template/table/body/before` */
27  $template::body_before( $gravityview );
28 
29  if ( ! $gravityview->entries->count() ) {
30  ?>
31  <tr>
32  <?php
33 
34  /** @action `gravityview/template/table/tr/before` */
35  $template::tr_before( $gravityview );
36 
37  ?>
38  <td colspan="<?php echo $gravityview->fields->by_position( 'directory_table-columns' )->by_visible( $gravityview->view )->count() ? : ''; ?>" class="<?php echo esc_attr( $no_results_css_class ); ?>">
39  <?php echo gv_no_results( true, $gravityview ); ?>
40  </td>
41  <?php
42 
43  /** @action `gravityview/template/table/tr/after` */
44  $template::tr_after( $gravityview );
45 
46  ?>
47  </tr>
48  <?php
49  } else {
50  foreach ( $gravityview->entries->all() as $entry ) {
51 
52  // Add `alt` class to alternate rows
53  $alt = empty( $alt ) ? 'alt' : '';
54 
55  /** @filter `gravityview/template/table/entry/class` */
56  $class = $template::entry_class( $alt, $entry, $gravityview );
57 
58  $attributes = array(
59  'class' => $class,
60  );
61 
62  $template->the_entry( $entry, $attributes );
63  }
64  }
65 
66  /** @action `gravityview/template/table/body/after` */
67  $template::body_after( $gravityview );
68  ?>
69  </tbody>
gv_no_results( $wpautop=true, $context=null)
Definition: class-api.php:942
$class
if(! isset( $gravityview)||empty( $gravityview->template)) $template
The entry loop for the table output.
gravityview()
The main GravityView wrapper function.
$entry
Definition: notes.php:27