Projet

Général

Profil

Paste
Télécharger (2,05 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / views / plugins / views_plugin_pager_mini.inc @ 5d12d676

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

    
15
  /**
16
   * {@inheritdoc}
17
   */
18
  public function summary_title() {
19
    if (!empty($this->options['offset'])) {
20
      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']));
21
    }
22
    return format_plural($this->options['items_per_page'], 'Mini pager, @count item', 'Mini pager, @count items', array('@count' => $this->options['items_per_page']));
23
  }
24

    
25
  /**
26
   * {@inheritdoc}
27
   */
28
  public function option_definition() {
29
    $options = parent::option_definition();
30

    
31
    // Overrides the full pager options form by deleting unused settings.
32
    unset($options['quantity']);
33
    unset($options['tags']['first']);
34
    unset($options['tags']['last']);
35
    $options['tags']['previous']['default'] = '‹‹';
36
    $options['tags']['next']['default'] = '››';
37

    
38
    return $options;
39
  }
40

    
41
  /**
42
   * {@inheritdoc}
43
   */
44
  public function options_form(&$form, &$form_state) {
45
    parent::options_form($form, $form_state);
46

    
47
    // Overrides the full pager options form by deleting unused settings.
48
    unset($form['quantity']);
49
    unset($form['tags']['first']);
50
    unset($form['tags']['last']);
51
  }
52

    
53
  /**
54
   * {@inheritdoc}
55
   */
56
  public function render($input) {
57
    // Overrides the full pager renderer by changing the theme function and
58
    // leaving out variables that are not used in the mini pager.
59
    $pager_theme = views_theme_functions('views_mini_pager', $this->view, $this->display);
60

    
61
    // The 1, 3 index are correct.
62
    // @see theme_pager().
63
    $tags = array(
64
      1 => $this->options['tags']['previous'],
65
      3 => $this->options['tags']['next'],
66
    );
67
    return theme($pager_theme, array(
68
      'tags' => $tags,
69
      'element' => $this->get_pager_id(),
70
      'parameters' => $input,
71
    ));
72
  }
73

    
74
}