You are here

function mediafront_handler_field_player::renderField in MediaFront 7

Same name and namespace in other branches
  1. 6.2 views/mediafront_handler_field_player.inc \mediafront_handler_field_player::renderField()
  2. 6 views/mediafront_handler_field_player.inc \mediafront_handler_field_player::renderField()
1 call to mediafront_handler_field_player::renderField()
mediafront_handler_field_player::render in views/mediafront_handler_field_player.inc
Render the field.

File

views/mediafront_handler_field_player.inc, line 118

Class

mediafront_handler_field_player
Field handler to provide simple renderer that turns a URL into a clickable link.

Code

function renderField($values, $fieldObj) {
  $entity = clone $values->_field_data[$fieldObj->field_alias]['entity'];
  $entity_type = $values->_field_data[$fieldObj->field_alias]['entity_type'];
  $langcode = $fieldObj
    ->field_language($entity_type, $entity);

  // The field we are trying to display doesn't exist on this entity.
  if (!isset($entity->{$fieldObj->definition['field_name']})) {
    return '';
  }
  $display = array(
    'type' => $fieldObj->options['type'],
    'settings' => $fieldObj->options['settings'],
    'label' => 'hidden',
  );
  $render_array = field_view_field($entity_type, $entity, $fieldObj->definition['field_name'], $display, $langcode);
  return render($render_array[0]);
}