You are here

function advpoll_field_field_formatter_view in Advanced Poll 7

Same name and namespace in other branches
  1. 7.3 advpoll_field/advpoll_field.module \advpoll_field_field_formatter_view()
  2. 7.2 advpoll_field/advpoll_field.module \advpoll_field_field_formatter_view()

Implements hook_field_formatter_view(). Write-in flag is not visible.

File

advpoll_field/advpoll_field.module, line 46
Provides a FieldAPI field type for presenting an Advanced Poll choice field with a Boolean checkbox to indicate write-in status.

Code

function advpoll_field_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
  $element = array();
  switch ($display['type']) {
    case 'advpoll_choice':
      foreach ($items as $delta => $item) {
        $element[$delta]['#markup'] = filter_xss($item['choice'], $allowed = array(
          'em',
          'strong',
          'a',
          'b',
          'i',
        ));
      }
      break;
  }
  return $element;
}