5 * Definition of views_plugin_pager_none.
9 * Plugin for views without pagers.
11 * @ingroup views_pager_plugins
13 class views_plugin_pager_none extends views_plugin_pager {
15 function init(&$view, &$display, $options = array()) {
16 parent::init($view, $display, $options);
18 // If the pager is set to none, then it should show all items.
19 $this->set_items_per_page(0);
22 function summary_title() {
23 if (!empty($this->options['offset'])) {
24 return t('All items, skip @skip', array('@skip' => $this->options['offset']));
26 return t('All items');
29 function option_definition() {
30 $options = parent::option_definition();
31 $options['offset'] = array('default' => 0);
37 * Provide the default form for setting options.
39 function options_form(&$form, &$form_state) {
40 parent::options_form($form, $form_state);
41 $form['offset'] = array(
42 '#type' => 'textfield',
43 '#title' => t('Offset'),
44 '#description' => t('The number of items to skip. For example, if this field is 3, the first 3 items will be skipped and not displayed.'),
45 '#default_value' => $this->options['offset'],
49 function use_pager() {
53 function use_count_query() {
57 function get_items_per_page() {
61 function execute_count_query(&$count_query) {
62 // If we are displaying all items, never count. But we can update the count in post_execute.
65 function post_execute(&$result) {
66 $this->total_items = count($result);
70 // The only query modifications we might do are offsets.
71 if (!empty($this->options['offset'])) {
72 $this->view->query->set_offset($this->options['offset']);