diff --git a/flexslider.admin.inc b/flexslider.admin.inc index d4e59cb..500e1d9 100755 --- a/flexslider.admin.inc +++ b/flexslider.admin.inc @@ -175,6 +175,19 @@ function flexslider_option_elements($options = array()) { '#maxlength' => 255, '#default_value' => isset($options['move']) ? $options['move'] : _flexslider_optionset_defaults('move'), ); + $form['animation_slideshow']['caption'] = array( + '#type' => 'select', + '#title' => t('Caption'), + '#multiple' => FALSE, + '#description' => t('Options for displaying text with the slideshow.'), + '#options' => array( + 'title' => t('Title'), + 'alt' => t('Alt'), + 'both' => t('Both'), + 'none' => t('None'), + ), + '#default_value' => isset($options['caption']) ? $options['caption'] : _flexslider_optionset_defaults('caption'), + ); // Navigation and Control Settings $form['nav_controls'] = array( diff --git a/flexslider.module b/flexslider.module index 5dcf375..a01cc3e 100755 --- a/flexslider.module +++ b/flexslider.module @@ -399,6 +399,7 @@ function _flexslider_optionset_defaults($key = NULL) { 'minItems' => 0, 'maxItems' => 0, 'move' => 0, + 'caption' => 'title', //'start' => '', //'before' => '', //'after' => '', @@ -468,6 +469,7 @@ function _flexslider_typecast_optionset(&$options) { case 'pauseText': case 'playText': case 'manualControls': + case 'caption': $options[$key] = (string)$value; break; case 'startAt': diff --git a/theme/flexslider.theme.inc b/theme/flexslider.theme.inc index 6ccc411..c763ef4 100755 --- a/theme/flexslider.theme.inc +++ b/theme/flexslider.theme.inc @@ -35,8 +35,29 @@ function theme_flexslider_list(&$vars) { 'title' => $item['title'], ); } + $caption = '
'; + $title = '' . check_plain($item['title']) . ''; + $alt = '' . check_plain($item['alt']) . ''; + $caption_style = $optionset->options['caption']; + switch ($caption_style) { + case 'none': + break; + case 'alt': + $caption .= $alt; + break; + case 'both': + $caption .= $title; + $caption .= ' ' . $alt; + break; + case 'title': + default: + $caption .= $title; + break; + } + $caption .= '
'; $output .= theme('flexslider_list_item', array( 'item' => isset($item['slide']) ? $item['slide'] : theme_image_style($image_options), + 'caption' => $caption, 'thumb' => isset($item['thumb']) ? $item['thumb'] : image_style_url($optionset->imagestyle_thumbnail, $item['uri']), 'optionset' => $optionset, )); @@ -62,7 +83,7 @@ function theme_flexslider_list_item(&$vars) { } $output = ''; - $output .= '' . $item . "\n"; + $output .= '' . $item . "\n" . $vars['caption'] . '' ."\n"; return $output; }