function royalslider_field_formatter_view in RoyalSlider Integration 7
Implements hook_field_formatter_view().
File
- ./
royalslider.module, line 856 - RoyalSlider module.
Code
function royalslider_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, &$items, $display) {
$settings = $display['settings'];
$element = array();
switch ($display['type']) {
case 'royalslider':
list($id, , $bundle) = entity_extract_ids($entity_type, $entity);
$images = $settings['max'] === '#' ? $items : array_slice($items, 0, $settings['max']);
// We merge all items into one slideshow element.
$element[0] = array(
'#theme' => 'royalslider',
'#royalslider_id' => "royalslider-{$entity_type}-{$bundle}-{$instance['field_name']}-{$id}",
'#optionset' => $settings['optionset'],
'#skin' => $settings['skin'],
'#items' => $images,
);
break;
}
return $element;
}