You are here

function rate_field_formatter_view in Rate 7.2

Implements hook_field_formatter_view().

File

./rate.module, line 224
Main module file for the Rate module.

Code

function rate_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
  $output = array();

  // Strip off "rate_" from display type to get widget mode.
  $mode = substr($display['type'], 5);
  foreach ($items as $item) {
    $item['attributes'] += array(
      'tag' => $field['settings']['tag'],
      'mode' => $mode,
      'displayed' => $display['settings']['displayed'],
      'displayed_just_voted' => $display['settings']['displayed_just_voted'],
      'field_name' => $field['field_name'],
    );
    $widget = new $item['class']($item['attributes']);
    $output[] = array(
      '#theme' => 'rate_widget',
      'widget' => $widget,
    );
  }
  return $output;
}