You are here

function ds_field_formatter_view in Display Suite 7

Same name and namespace in other branches
  1. 7.2 ds.module \ds_field_formatter_view()

Implements hook_field_formatter_view().

File

./ds.module, line 1330
Display Suite core functions.

Code

function ds_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
  $element = array();
  $view_mode = substr($display['type'], 0, 9) == 'taxonomy_' ? substr($display['type'], 9) : $display['type'];
  foreach ($items as $delta => $item) {
    if ($item['tid'] == 'autocreate') {

      // We don't necessarily have a link when this is
      // an autocreated term, usually in preview.
      // So just send the term as check plained markup.
      $build['#markup'] = check_plain($item['name']);
    }
    else {
      $build = taxonomy_term_view(taxonomy_term_load($item['tid']), $view_mode, $langcode);
    }
    $element[$delta] = $build;
  }
  return $element;
}