views_slideshow_xtra.theme.inc in Views Slideshow Xtra 7
Same filename and directory in other branches
Views Slideshow Xtra theming functions.
File
theme/views_slideshow_xtra.theme.incView source
<?php
/**
* @file
* Views Slideshow Xtra theming functions.
*/
/**
* Views Slideshow Widget rendering.
*
* @ingroup themeable
*/
function theme_views_slideshow_xtra_widget_render($vars) {
// Add javascript settings for the pager type.
$js_vars = array(
'viewsSlideshowXtra' => array(
$vars['vss_id'] => array(
'displayDelay' => $vars['settings']['display_delay'],
'displayDelayFade' => $vars['settings']['display_delay_fade'],
),
),
);
drupal_add_js($js_vars, 'setting');
$output = '<div id="views-slideshow-xtra-' . $vars['vss_id'] . '" class="views-slideshow-xtra-wrapper">';
// TODO Make field types plugable
//$field_types = views_slideshow_xtra_field_types();
// Render each slide.
foreach ($vars['view']->result as $count => $node) {
// Render each field.
foreach ($vars['settings']['fields'] as $field) {
if ($field) {
if (is_object($vars['view']->field[$field])) {
$field_values_stub = $vars['view']->result[$count]->_field_data['nid']['entity']->{$field};
$item_indexes = array(
'text' => 0,
'link' => 0,
'lightbox_link' => 0,
);
// Render each vsx element, if there are any defined.
if (isset($field_values_stub['und'])) {
foreach ($field_values_stub['und'] as $field_info) {
if ($item_indexes['text'] == 0 && $item_indexes['link'] == 0 && $item_indexes['lightbox_link'] == 0) {
$output .= '<div class="views-slideshow-xtra-row views-slideshow-xtra-row-' . $count . '">';
}
$field_data = drupal_json_decode($field_info['value']);
if (is_null($field_data)) {
$field_data = array();
}
$field_data += array(
'type' => 'text',
'left' => 0,
'top' => 0,
'text' => '',
'url' => '',
'modal' => false,
'width' => 900,
'height' => 600,
);
$output .= theme('views_slideshow_xtra_' . $field_data['type'], array(
'vss_id' => $vars['vss_id'],
'view' => $vars['view'],
'field' => $field_data,
'slide_count' => $count,
'field_item_count' => $item_indexes[$field_data['type']],
));
$item_indexes[$field_data['type']] = $item_indexes[$field_data['type']] + 1;
}
if ($item_indexes['text'] != 0 || $item_indexes['link'] != 0 || $item_indexes['lightbox_link'] != 0) {
$output .= '</div>';
}
}
}
}
}
}
$output .= '</div>';
//dsm($output);
return $output;
}
/**
* Text element template_preprocess.
*/
function template_preprocess_views_slideshow_xtra_text(&$vars) {
$js_vars = array(
'viewsSlideshowXtra' => array(
$vars['vss_id'] => array(
'slideInfo' => array(
'text' => array(
'slide-' . $vars['slide_count'] => array(
'item-' . $vars['field_item_count'] => array(
'left' => $vars['field']['left'],
'top' => $vars['field']['top'],
),
),
),
),
),
),
);
drupal_add_js($js_vars, 'setting');
}
/**
* Link element template_preprocess.
*/
function template_preprocess_views_slideshow_xtra_link(&$vars) {
$js_vars = array(
'viewsSlideshowXtra' => array(
$vars['vss_id'] => array(
'slideInfo' => array(
'link' => array(
'slide-' . $vars['slide_count'] => array(
'item-' . $vars['field_item_count'] => array(
'left' => $vars['field']['left'],
'top' => $vars['field']['top'],
),
),
),
),
),
),
);
drupal_add_js($js_vars, 'setting');
// Modal popup
if ($vars['field']['modal']) {
$vars['field']['url'] .= '?width=' . $vars['field']['width'] . '&height=' . $vars['field']['height'] . '&iframe=true';
}
}
Functions
Name![]() |
Description |
---|---|
template_preprocess_views_slideshow_xtra_link | Link element template_preprocess. |
template_preprocess_views_slideshow_xtra_text | Text element template_preprocess. |
theme_views_slideshow_xtra_widget_render | Views Slideshow Widget rendering. |