You are here

function _views_slideshow_royalslider_new_attributes in RoyalSlider Integration 7

Helper function to create the new attribues for the slide item.

2 calls to _views_slideshow_royalslider_new_attributes()
_views_slideshow_royalslider_process_image_item in contrib/views_slideshow_royalslider/views_slideshow_royalslider.module
_views_slideshow_royalslider_process_video_item in contrib/views_slideshow_royalslider/views_slideshow_royalslider.module

File

contrib/views_slideshow_royalslider/views_slideshow_royalslider.module, line 149
Views Slideshow: RoyalSlider module.

Code

function _views_slideshow_royalslider_new_attributes($render_item, $media_type = 'image') {

  // Add the rsImg class to the image field.
  $original_attributes = array();
  if (array_key_exists('attributes', $render_item)) {
    $original_attributes = $render_item['#options']['attributes'];
  }
  $slider_class = array(
    'class' => array(
      'rsImg',
    ),
  );
  $new_attributes = array_merge($original_attributes, $slider_class);
  if ($media_type == 'video') {
    $new_attributes['data-rsVideo'] = file_create_url($render_item['#uri']);
  }
  return $new_attributes;
}