You are here

function mediafront_filefield_save in MediaFront 6.2

Same name and namespace in other branches
  1. 6 includes/mediafront.filefield.inc \mediafront_filefield_save()
  2. 7 includes/mediafront.filefield.inc \mediafront_filefield_save()

Adds or updates a mediafront filefield entry

1 call to mediafront_filefield_save()
mediafront_filefield_submit in includes/mediafront.filefield.inc
Called when the user submits the FileField form.

File

includes/mediafront.filefield.inc, line 6

Code

function mediafront_filefield_save($node_type, $field_name, $media_type, $node_preset, $thumb_preset) {
  $field = mediafront_filefield_get($node_type, $field_name);
  $fields = array(
    'node_type' => $node_type,
    'field_name' => $field_name,
    'media_type' => $media_type,
    'node_preset' => $node_preset,
    'thumb_preset' => $thumb_preset,
  );
  $fid = isset($field->fid) && $field->fid ? 'fid' : array();
  if ($fid) {
    $fields['fid'] = $field->fid;
  }
  return drupal_write_record('mediafront_filefield', $fields, $fid);
}