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