GravityView  1.19.4
The best, easiest way to display Gravity Forms entries on your website.
class-gravityview-widget-pagination-info.php
Go to the documentation of this file.
1 <?php
2 
3 
4 /**
5  * Widget to display pagination info
6  *
7  * @extends GravityView_Widget
8  */
10 
11  /**
12  * Does this get displayed on a single entry?
13  * @var boolean
14  */
15  protected $show_on_single = false;
16 
17  function __construct() {
18 
19  $this->widget_description = __('Summary of the number of visible entries out of the total results.', 'gravityview' );
20 
21  $default_values = array(
22  'header' => 1,
23  'footer' => 1,
24  );
25 
26  $settings = array();
27 
28  parent::__construct( __( 'Show Pagination Info', 'gravityview' ) , 'page_info', $default_values, $settings );
29  }
30 
31  public function render_frontend( $widget_args, $content = '', $context = '') {
33 
34  if( !$this->pre_render_frontend() ) {
35  return;
36  }
37 
38  if( !empty( $widget_args['title'] ) ) {
39  echo $widget_args['title'];
40  }
41 
42  $pagination_counts = $gravityview_view->getPaginationCounts();
43 
44  $total = $first = $last = null;
45 
46  $output = '';
47 
48  if( ! empty( $pagination_counts ) ) {
49 
50  $first = $pagination_counts['first'];
51  $last = $pagination_counts['last'];
52  $total = $pagination_counts['total'];
53 
54  $class = !empty( $widget_args['custom_class'] ) ? $widget_args['custom_class'] : '';
55  $class = gravityview_sanitize_html_class( $class );
56 
57  $output = '<div class="gv-widget-pagination '.$class.'"><p>'. sprintf(__( 'Displaying %1$s - %2$s of %3$s', 'gravityview' ), number_format_i18n( $first ), number_format_i18n( $last ), number_format_i18n( $total ) ) . '</p></div>';
58  }
59 
60  /**
61  * @filter `gravityview_pagination_output` Modify the pagination widget output
62  * @param string $output HTML output
63  * @param int $first First entry #
64  * @param int $last Last entry #
65  * @param int $total Total entries #
66  */
67  echo apply_filters( 'gravityview_pagination_output', $output, $first, $last, $total );
68 
69  }
70 
71 }
72 
Main GravityView widget class.
$class
render_frontend($widget_args, $content= '', $context= '')
pre_render_frontend()
General validations when rendering the widget.
static getInstance($passed_post=NULL)
if(empty($field_settings['content'])) $content
Definition: custom.php:37