summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/views_plugin_pager_mini.inc48
-rw-r--r--theme/theme.inc6
-rw-r--r--views.module2
3 files changed, 47 insertions, 9 deletions
diff --git a/plugins/views_plugin_pager_mini.inc b/plugins/views_plugin_pager_mini.inc
index 2daea99..bec48c8 100644
--- a/plugins/views_plugin_pager_mini.inc
+++ b/plugins/views_plugin_pager_mini.inc
@@ -6,7 +6,7 @@
*/
/**
- * The plugin to handle full pager.
+ * The plugin to handle mini pager.
*
* @ingroup views_pager_plugins
*/
@@ -18,9 +18,53 @@ class views_plugin_pager_mini extends views_plugin_pager_full {
return format_plural($this->options['items_per_page'], 'Mini pager, @count item', 'Mini pager, @count items', array('@count' => $this->options['items_per_page']));
}
+ /**
+ * Overrides views_plugin_pager_full::option_definition().
+ *
+ * Overrides the full pager options form by deleting unused settings.
+ */
+ function option_definition() {
+ $options = parent::option_definition();
+
+ unset($options['quantity']);
+ unset($options['tags']['first']);
+ unset($options['tags']['last']);
+ $options['tags']['previous']['default'] = '‹‹';
+ $options['tags']['next']['default'] = '››';
+
+ return $options;
+ }
+
+ /**
+ * Overrides views_plugin_pager_full::options_form().
+ *
+ * Overrides the full pager options form by deleting unused settings.
+ */
+ function options_form(&$form, &$form_state) {
+ parent::options_form($form, $form_state);
+ unset($form['quantity']);
+ unset($form['tags']['first']);
+ unset($form['tags']['last']);
+ }
+
+ /**
+ * Overrides views_plugin_pager_full::render().
+ *
+ * Overrides the full pager renderer by changing the theme function
+ * and leaving out variables that are not used in the mini pager.
+ */
function render($input) {
$pager_theme = views_theme_functions('views_mini_pager', $this->view, $this->display);
+ // The 1, 3 index are correct.
+ // @see theme_pager().
+ $tags = array(
+ 1 => $this->options['tags']['previous'],
+ 3 => $this->options['tags']['next'],
+ );
return theme($pager_theme, array(
- 'parameters' => $input, 'element' => $this->options['id']));
+ 'tags' => $tags,
+ 'element' => $this->options['id'],
+ 'parameters' => $input,
+ ));
}
}
diff --git a/theme/theme.inc b/theme/theme.inc
index 1749662..e7f7a15 100644
--- a/theme/theme.inc
+++ b/theme/theme.inc
@@ -1040,19 +1040,13 @@ function theme_views_mini_pager($vars) {
$tags = $vars['tags'];
$element = $vars['element'];
$parameters = $vars['parameters'];
- $quantity = $vars['quantity'];
- // Calculate various markers within this pager piece:
- // Middle is used to "center" pages around the current page.
- $pager_middle = ceil($quantity / 2);
// current is the page we are currently paged to
$pager_current = $pager_page_array[$element] + 1;
// max is the maximum page number
$pager_max = $pager_total[$element];
// End of marker calculations.
-
-
if ($pager_total[$element] > 1) {
$li_previous = theme('pager_previous',
diff --git a/views.module b/views.module
index 3b9eff1..68953e5 100644
--- a/views.module
+++ b/views.module
@@ -69,7 +69,7 @@ function views_theme($existing, $type, $theme, $path) {
// Our extra version of pager from pager.inc
$hooks['views_mini_pager'] = $base + array(
- 'variables' => array('tags' => array(), 'quantity' => 10, 'element' => 0, 'parameters' => array()),
+ 'variables' => array('tags' => array(), 'element' => 0, 'parameters' => array()),
'pattern' => 'views_mini_pager__',
);