1
|
<?php
|
2
|
|
3
|
/**
|
4
|
* @file
|
5
|
* Definition of views_plugin_pager_mini.
|
6
|
*/
|
7
|
|
8
|
/**
|
9
|
* The plugin to handle mini pager.
|
10
|
*
|
11
|
* @ingroup views_pager_plugins
|
12
|
*/
|
13
|
class views_plugin_pager_mini extends views_plugin_pager_full {
|
14
|
function summary_title() {
|
15
|
if (!empty($this->options['offset'])) {
|
16
|
return format_plural($this->options['items_per_page'], 'Mini pager, @count item, skip @skip', 'Mini pager, @count items, skip @skip', array('@count' => $this->options['items_per_page'], '@skip' => $this->options['offset']));
|
17
|
}
|
18
|
return format_plural($this->options['items_per_page'], 'Mini pager, @count item', 'Mini pager, @count items', array('@count' => $this->options['items_per_page']));
|
19
|
}
|
20
|
|
21
|
/**
|
22
|
* Overrides views_plugin_pager_full::option_definition().
|
23
|
*
|
24
|
* Overrides the full pager options form by deleting unused settings.
|
25
|
*/
|
26
|
function option_definition() {
|
27
|
$options = parent::option_definition();
|
28
|
|
29
|
unset($options['quantity']);
|
30
|
unset($options['tags']['first']);
|
31
|
unset($options['tags']['last']);
|
32
|
$options['tags']['previous']['default'] = '‹‹';
|
33
|
$options['tags']['next']['default'] = '››';
|
34
|
|
35
|
return $options;
|
36
|
}
|
37
|
|
38
|
/**
|
39
|
* Overrides views_plugin_pager_full::options_form().
|
40
|
*
|
41
|
* Overrides the full pager options form by deleting unused settings.
|
42
|
*/
|
43
|
function options_form(&$form, &$form_state) {
|
44
|
parent::options_form($form, $form_state);
|
45
|
unset($form['quantity']);
|
46
|
unset($form['tags']['first']);
|
47
|
unset($form['tags']['last']);
|
48
|
}
|
49
|
|
50
|
/**
|
51
|
* Overrides views_plugin_pager_full::render().
|
52
|
*
|
53
|
* Overrides the full pager renderer by changing the theme function
|
54
|
* and leaving out variables that are not used in the mini pager.
|
55
|
*/
|
56
|
function render($input) {
|
57
|
$pager_theme = views_theme_functions('views_mini_pager', $this->view, $this->display);
|
58
|
// The 1, 3 index are correct.
|
59
|
// @see theme_pager().
|
60
|
$tags = array(
|
61
|
1 => $this->options['tags']['previous'],
|
62
|
3 => $this->options['tags']['next'],
|
63
|
);
|
64
|
return theme($pager_theme, array(
|
65
|
'tags' => $tags,
|
66
|
'element' => $this->get_pager_id(),
|
67
|
'parameters' => $input,
|
68
|
));
|
69
|
}
|
70
|
}
|