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