You are here

function royalsliderfield_field_formatter_view in RoyalSlider Integration 7

Implements hook_field_formatter_view().

See also

royalsliderfield_field_formatter_info()

File

contrib/royalsliderfield/royalsliderfield.module, line 73
RoyalSlider Field module.

Code

function royalsliderfield_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
  $element = array();
  $settings = $display['settings'];
  switch ($display['type']) {
    case 'royalsliderfields_formatter':
      $slides = array();
      foreach ($items as $delta => $item) {
        $slides[$delta] = $item;
      }
      list($id, , $bundle) = entity_extract_ids($entity_type, $entity);
      $element[0] = array(
        '#theme' => 'royalsliderfield',
        '#royalslider_id' => "royalslider-{$entity_type}-{$bundle}-{$instance['field_name']}-{$id}",
        '#slides' => $slides,
        '#optionset' => $settings['royalslider_optionset'],
      );
      break;
  }
  return $element;
}