You are here

function mediafront_field_formatter_view in MediaFront 7

Same name and namespace in other branches
  1. 7.2 includes/mediafront.field.inc \mediafront_field_formatter_view()

Implements hook_field_formatter_view().

File

includes/mediafront.field.inc, line 80

Code

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

  // Check if the formatter involves a particular image style.
  $matches = array();
  if (preg_match('/__([a-z0-9_]+)/', $display['type'], $matches)) {
    $preset = $matches[1];
  }
  $element[] = array(
    '#theme' => 'mediafront_player_formatter',
    '#entity' => $entity,
    '#preset' => isset($preset) ? $preset : '',
  );
  return $element;
}