This repository has been archived by the owner on Mar 18, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
views-spin-carousel.tpl.php
73 lines (67 loc) · 2.42 KB
/
views-spin-carousel.tpl.php
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<?php if( !is_array( $options['front_fields'] ) ) {
$front_fields = explode( ' ', $options['front_fields'] );
} else {
$front_fields = array();
}
?>
<?php
function views_spin_carousel_render_field( $field_key, $field_config, $row ) {
// TODO: Handle other handlers.
// TODO: Handle rewritten fields.
/* print_r( $field_key );
echo( '<pre>' );
print_r( $row );
echo( '</pre>' ); */
if( 'node' == $field_config->table ) {
$field_data_key = 'node_'.$field_key;
echo( '<h3 class="node-title">'.$row->{$field_data_key}.'</h3>' );
} else {
$field_data_key = 'field_'.$field_key;
if( !empty( $field_config->options['element_wrapper_type'] ) ) {
// Add the wrapper element.
echo(
'<'.$field_config->options['element_wrapper_type'].' class="'.
$field_config->options['element_wrapper_class'].'">'
);
}
echo( drupal_render( $row->{$field_data_key}[0]['rendered'] ) );
if( !empty( $field_config->options['element_wrapper_type'] ) ) {
// Add the wrapper element.
echo(
'</'.$field_config->options['element_wrapper_type'].'>'
);
}
}
}
?>
<div class="views-spin-carousel-degrade">
For the best experience, please use a modern web browser such as <a href="https://www.mozilla.org/en-US/firefox">Firefox</a> or <a href="https://www.google.com/chrome/">Google Chrome</a>. If you <em>are</em> using a modern browser, then it is possible that your browser does not support 3D acceleration with your current hardware.
</div>
<div class="views-spin-carousel-container">
<div class="views-spin-carousel">
<?php for( $i = 0 ; $i < count( $rows ) ; $i++ ) { ?>
<div class="views-spin-carousel-panel">
<div class="views-spin-carousel-flipper">
<div class="views-spin-carousel-flipper-front">
<?php foreach( $view->field as $field_key => $field_config ) { ?>
<?php if( in_array( $field_key, $front_fields ) ) {
views_spin_carousel_render_field(
$field_key, $field_config, $rows[$i]
);
} ?>
<?php } ?>
</div>
<div class="views-spin-carousel-flipper-back">
<?php foreach( $view->field as $field_key => $field_config ) { ?>
<?php if( !in_array( $field_key, $front_fields ) ) {
views_spin_carousel_render_field(
$field_key, $field_config, $rows[$i]
);
} ?>
<?php } ?>
</div>
</div>
</div>
<?php } ?>
</div>
</div>