You are here

function theme_jquery_carousel_field_formatter in jQuery carousel 7

Theme callback for jQeury carousel field formatter.

1 theme call to theme_jquery_carousel_field_formatter()
jquery_carousel_field_formatter_view in ./jquery_carousel.module
Implements hook_field_formatter_view().

File

./jquery_carousel.module, line 185
Provide jquery carousel style plugin for views.

Code

function theme_jquery_carousel_field_formatter($vars) {
  _jquery_carousel_settings_format($vars['settings']);
  _jquery_carousel_include_css_js($vars['settings']);
  $output = '';
  if (is_array($vars['element']) && count($vars['element']) > 1) {
    $selector_class = drupal_attributes(array(
      'class' => $vars['settings']['selector'],
    ));
    $output .= '<div ' . $selector_class . '">';
    $output .= '<ul>';
    foreach ($vars['element'] as $elem) {
      $output .= '<li>';
      $output .= theme('image_style', array(
        'path' => $elem['uri'],
        'style_name' => $vars['settings']['style_name'],
      ));
      $output .= '</li>';
    }
    $output .= '</ul>';
    $output .= '</div>';
  }
  else {
    $output .= theme('image_style', array(
      'path' => $vars['element'][0]['uri'],
      'style_name' => $vars['settings']['style_name'],
    ));
  }
  return $output;
}