You are here

function tweet_feed_field_formatter_view in Tweet Feed 7.2

Same name and namespace in other branches
  1. 7.3 tweet_feed.field_info.inc \tweet_feed_field_formatter_view()

Implements hook_field_formatter_view().

File

./tweet_feed.field_info.inc, line 82

Code

function tweet_feed_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
  $element = $mentions = array();
  switch ($display['type']) {

    // Override check plain
    case 'tweet_feed_user_mentions':
      foreach ($items as $delta => $item) {
        $mentions[] = $item['tweet_feed_mention_name'] . ' (' . $item['tweet_feed_mention_screen_name'] . '): ' . $item['tweet_feed_mention_id'];
      }
      $mentions = implode('<br />', $mentions);
      $element[$delta] = array(
        '#markup' => $mentions,
      );
      break;

    // Give us a way to display emoji.
    case 'emoji_formatter':
      foreach ($items as $delta => $item) {
        $element[$delta] = array(
          '#markup' => utf8_decode($item['value']),
        );
      }
      break;
  }
  return $element;
}