Skip to content

Commit

Permalink
Let us see if this is the correct way 😄 -- @jordandukart @whikloj @Di…
Browse files Browse the repository at this point in the history
  • Loading branch information
ruebot committed Oct 2, 2015
1 parent 7435e39 commit 9386690
Showing 1 changed file with 15 additions and 17 deletions.
32 changes: 15 additions & 17 deletions includes/audio_upload.form.inc
Expand Up @@ -92,23 +92,21 @@ function islandora_audio_audio_upload_form_validate(array $form, array &$form_st
*/
function islandora_audio_audio_upload_form_submit(array $form, array &$form_state) {
module_load_include('inc', 'islandora', 'includes/utilities');
$objects = &islandora_ingest_form_get_objects($form_state);
foreach ($objects as $object) {
if (empty($object['OBJ'])) {
$obj = $object->constructDatastream('OBJ', 'M');
$object->ingestDatastream($obj);
}
else {
$obj = $object['OBJ'];
}
$audio_file = file_load($form_state['values']['audio_file']);
$obj->setContentFromFile(drupal_realpath($audio_file->uri), FALSE);
if ($obj->label != $audio_file->filename) {
$obj->label = $audio_file->filename;
}
if ($obj->mimetype != $audio_file->filemime) {
$obj->mimetype = $audio_file->filemime;
}
$object = islandora_ingest_form_get_object($form_state);
if (empty($object['OBJ'])) {
$obj = $object->constructDatastream('OBJ', 'M');
$object->ingestDatastream($obj);
}
else {
$obj = $object['OBJ'];
}
$audio_file = file_load($form_state['values']['audio_file']);
$obj->setContentFromFile(drupal_realpath($audio_file->uri), FALSE);
if ($obj->label != $audio_file->filename) {
$obj->label = $audio_file->filename;
}
if ($obj->mimetype != $audio_file->filemime) {
$obj->mimetype = $audio_file->filemime;
}

if ($form_state['values']['supply_thumbnail']) {
Expand Down

0 comments on commit 9386690

Please sign in to comment.