function mediafront_filefield_save in MediaFront 7
Same name and namespace in other branches
- 6.2 includes/mediafront.filefield.inc \mediafront_filefield_save()
- 6 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($entity, $bundle, $field_name, $media_type, $node_preset, $thumb_preset) {
$field = mediafront_filefield_get($entity, $bundle, $field_name);
$fields = array(
'entity' => $entity,
'bundle' => $bundle,
'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);
}