1 |
85ad3d82
|
Assos Assos
|
<?php
|
2 |
|
|
|
3 |
|
|
/**
|
4 |
|
|
* @file
|
5 |
|
|
* Theme functions for FlexSlider Views
|
6 |
|
|
*
|
7 |
|
|
* @author Mathew Winstone <mwinstone@coldfrontlabs.ca>
|
8 |
|
|
*/
|
9 |
|
|
|
10 |
|
|
/**
|
11 |
|
|
* Add a preprocessor to prepare data from FlexSlider Views
|
12 |
|
|
*/
|
13 |
|
|
function template_process_flexslider_views(&$vars) {
|
14 |
|
|
// Only run the preprocessor if it is a view
|
15 |
|
|
if (!empty($vars['view'])) {
|
16 |
|
|
// Prepare all data to be passed to theme_flexslider().
|
17 |
|
|
$items = array();
|
18 |
|
|
$view = $vars['view'];
|
19 |
|
|
$settings = array();
|
20 |
|
|
$settings['optionset'] = $vars['options']['optionset'];
|
21 |
|
|
|
22 |
|
|
$row_plugin = $view->style_plugin->row_plugin;
|
23 |
|
|
|
24 |
|
|
foreach ($vars['rows'] as $id => $row) {
|
25 |
|
|
// Render the row into a slide
|
26 |
|
|
$view->row_index = $id;
|
27 |
|
|
$item['slide'] = $row_plugin->render($row);
|
28 |
|
|
$item['caption'] = (isset($row->caption) && !empty($row->caption)) ? $row->caption : NULL;
|
29 |
|
|
$items[] = $item;
|
30 |
|
|
}
|
31 |
|
|
|
32 |
|
|
// Add the slide items to the variables
|
33 |
|
|
$vars['items'] = $items;
|
34 |
|
|
|
35 |
|
|
// Add the attributes
|
36 |
|
|
$settings['attributes']['id'] = $vars['options']['id'];
|
37 |
|
|
|
38 |
|
|
// Reset the options to the processed values
|
39 |
|
|
$vars['settings'] = $settings;
|
40 |
|
|
}
|
41 |
|
|
return $vars;
|
42 |
|
|
} |