-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathagallery.module
31 lines (27 loc) · 1.22 KB
/
agallery.module
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
include_once('agallery.features.inc');
function agallery_preprocess_node(&$vars, $hook) {
if ($vars['type'] == "gallery") {
unset($vars['content']);
drupal_add_js(drupal_get_path('module', 'agallery') . '/css/agallery.css');
drupal_add_js(drupal_get_path('module', 'agallery') . '/js/jquery.cycle.min.js');
drupal_add_js(drupal_get_path('module', 'agallery') . '/js/agallery.js');
$vars['content'] = '<div class="gallery-body">' . $vars['node']->content['body']['#value'] . '</div>';
$vars['content'] .= '<div id="gallery-pages">';
$image_chunks = array_chunk($vars['field_images'], 9);
foreach($image_chunks as $chunk => $images) {
$vars['content'] .= '<div class="gallery-page" ';
//$vars['content'] .= $chunk ? 'style="display:none"' : '';
$vars['content'] .= '>';
foreach ($images as $image) {
$vars['content'] .= $image['view'];
}
$vars['content'] .= '</div>';
}
$vars['content'] .= '</div>';
if (count($image_chunks) > 1) {
$vars['content'] .= '<div class="gallery-navigation"><a id="prev" href="#">« Prejšnja</a><div id="nav"></div>';
$vars['content'] .= '<a id="next" href="#">Naslednja »</a></div>';
}
}
}