1 |
7547bb19
|
Assos Assos
|
<?php
|
2 |
|
|
|
3 |
|
|
|
4 |
|
|
|
5 |
|
|
|
6 |
|
|
|
7 |
|
|
|
8 |
|
|
|
9 |
|
|
|
10 |
|
|
|
11 |
|
|
|
12 |
|
|
|
13 |
|
|
|
14 |
|
|
|
15 |
|
|
|
16 |
|
|
function bootstrap_preprocess_date_views_pager(&$variables) {
|
17 |
|
|
$mini = !empty($variables['mini']);
|
18 |
|
|
|
19 |
|
|
|
20 |
|
|
$types = array(
|
21 |
|
|
|
22 |
|
|
|
23 |
|
|
|
24 |
|
|
'prev' => t('Prev', array(), array('context' => 'date_nav')),
|
25 |
|
|
'next' => t('Next', array(), array('context' => 'date_nav')),
|
26 |
|
|
);
|
27 |
|
|
|
28 |
|
|
|
29 |
|
|
$icons = array(
|
30 |
|
|
'prev' => array(
|
31 |
|
|
'name' => 'menu-left',
|
32 |
|
|
'default' => '« ',
|
33 |
|
|
'position' => 'before',
|
34 |
|
|
),
|
35 |
|
|
'next' => array(
|
36 |
|
|
'name' => 'menu-right',
|
37 |
|
|
'default' => ' »',
|
38 |
|
|
'position' => 'after',
|
39 |
|
|
),
|
40 |
|
|
);
|
41 |
|
|
|
42 |
|
|
|
43 |
|
|
$items = [];
|
44 |
|
|
foreach ($types as $type => $text) {
|
45 |
|
|
$item_classes = array($type);
|
46 |
|
|
|
47 |
|
|
$options = isset($variables[$type . '_options']) ? $variables[$type . '_options']: array();
|
48 |
|
|
$options += array('attributes' => array());
|
49 |
|
|
|
50 |
|
|
$url = $variables[$type . '_url'];
|
51 |
|
|
|
52 |
|
|
if (!$url) {
|
53 |
|
|
$url = '#';
|
54 |
|
|
$item_classes[] = 'disabled';
|
55 |
|
|
$options['absolute'] = TRUE;
|
56 |
|
|
$options['external'] = TRUE;
|
57 |
|
|
}
|
58 |
|
|
|
59 |
|
|
elseif (!empty($options['attributes']['title']) && bootstrap_setting('tooltip_enabled')) {
|
60 |
|
|
$options['attributes']['data-toggle'] = 'tooltip';
|
61 |
|
|
$options['attributes']['data-placement'] = 'bottom';
|
62 |
|
|
}
|
63 |
|
|
|
64 |
|
|
|
65 |
|
|
$link = array(
|
66 |
|
|
'#theme' => 'link__date_views__pager__' . $type,
|
67 |
|
|
'#text' => $text,
|
68 |
|
|
'#path' => $url,
|
69 |
|
|
'#options' => $options,
|
70 |
|
|
);
|
71 |
|
|
|
72 |
|
|
|
73 |
|
|
if (isset($icons[$type])) {
|
74 |
|
|
$icon = $icons[$type];
|
75 |
|
|
$link['#icon'] = _bootstrap_icon($icon['name'], $icon['default']);
|
76 |
|
|
$link['#icon_position'] = $mini ? 'icon_only' : $icon['position'];
|
77 |
|
|
}
|
78 |
|
|
|
79 |
|
|
$items[$type] = array(
|
80 |
|
|
'class' => $item_classes,
|
81 |
|
|
'data' => $link,
|
82 |
|
|
);
|
83 |
|
|
}
|
84 |
|
|
|
85 |
|
|
|
86 |
|
|
$variables['items'] = array(
|
87 |
|
|
'#theme' => 'item_list__date_views__pager',
|
88 |
|
|
'#attributes' => array('class' => array('pagination', 'pull-right')),
|
89 |
|
|
'#items' => $items,
|
90 |
|
|
);
|
91 |
|
|
|
92 |
|
|
|
93 |
|
|
$variables['attributes_array']['class'][] = 'clearfix';
|
94 |
|
|
$variables['attributes_array']['class'][] = 'date-nav-wrapper';
|
95 |
|
|
|
96 |
|
|
|
97 |
|
|
|
98 |
|
|
if (!empty($variables['extra_classes'])) {
|
99 |
|
|
if (is_string($variables['extra_classes'])) {
|
100 |
|
|
$variables['extra_classes'] = explode(' ', $variables['extra_classes']);
|
101 |
|
|
}
|
102 |
|
|
$variables['attributes_array']['class'] = array_merge(isset($variables['attributes']['class']) ? $variables['attributes']['class'] : array(), $variables['extra_classes']);
|
103 |
|
|
}
|
104 |
|
|
} |