You are here

function mediafront_get_view_field_value in MediaFront 7.2

Returns the field values for a view entry.

File

./mediafront.module, line 621

Code

function mediafront_get_view_field_value($row, $field) {
  $value = $field['field']
    ->get_value($row);
  if (!$value) {
    $field_name = $field['field']->handler_type . '_' . $field['field']->field;
    $offset = $field['field']->options['delta_offset'];
    $value = !empty($row->{$field_name}[$offset]['raw']) ? $row->{$field_name}[$offset]['raw'] : array();
  }
  $values = !$value || is_array($value) && !empty($value[0]) ? $value : array(
    $value,
  );
  foreach ($values as $key => $value) {
    if (is_array($value)) {
      $values[$key] = mediafront_get_node_field_instance_value($value);
    }
  }
  return $values;
}