You are here

function node_convert_get_field_value in Node Convert 6

Returns a string contaning the value of the $field from the $node object.

Parameters

$node: A $node object

$field: The field who's value to get.

Return value

A string contaning the value of the $field from the $node object.

1 call to node_convert_get_field_value()
node_convert_conversion_form in ./node_convert.module

File

./node_convert.module, line 963
The node_convert module converts nodes from one type to another.

Code

function node_convert_get_field_value($node, $field) {
  $value = '';
  if ($field['type'] == "image") {
    $value = $node->{$field['field_name']}[0]['title'] . " ; " . $node->{$field['field_name']}[0]['filepath'];
  }
  elseif ($field['type'] == "link") {
    $value = $node->{$field['field_name']}[0]['url'] . " ; " . $node->{$field['field_name']}[0]['title'];
  }
  elseif ($field['type'] == "email") {
    $value = $node->{$field['field_name']}[0]['email'];
  }
  elseif ($field['type'] == "file_audio" || $field['type'] == "file_video") {
    $value = $node->{$field['field_name']}[0]['filename'] . " " . $node->{$field['field_name']}[0]['filemime'] . " " . $node->{$field['field_name']}[0]['filesize'] . " " . t("bytes");
  }
  elseif ($field['type'] == "nodereference") {
    $value = "nid: " . $node->{$field['field_name']}[0]['nid'];
  }
  elseif ($field['type'] == "userreference") {
    $value = "uid: " . $node->{$field['field_name']}[0]['uid'];
  }
  else {
    $value = $node->{$field['field_name']}[0]['value'];
  }
  if (empty($value)) {
    $value = 'NULL';
  }
  return $value;
}