Given the following metadata:
`$item_metadata = array(
'collection_id' => '1',
'item_type_id' => '1',
'tags' => '',
'public' => false,
'featured' => false,
'overwriteElementTexts' => true
);
$item_element_texts = array(
'Dublin Core'=>array(
'Title'=>array(array('text'=>$data['title'], 'html'=>true)),
'Description'=>array(array('text'=>$data['captio'], 'html'=>false)),
'Publisher'=>array(array('text'=>$data['reposi'], 'html'=>false)),
'Source'=>array(array('text'=>$data['reposi'], 'html'=>true))
)
);
$provider_url = 'http://dc.lib.unc.edu/cdm/compoundobject/collection/sohp/id/' . $data['dmrecord'];
$provider_name = $data['reposi'];
$provider = "<a href=\"$provider_url\">$provider_name</a>";
$item_element_texts['Dublin Core']['Publisher'] = array(
array('text'=>$provider, 'html'=>true)
);
$file_metadata = array(
'file_transfer_type' => 'Url',
'files' => trim($url->loc)
);`
It checks if the file already exists and updates if if does otherwise add the the record
if($exists && ($record_action == 'updated' || $record_action == '')) {
$success = update_item($updated, $item_metadata, $item_element_texts, $file_metadata);
} else {
$created = insert_item($item_metadata, $item_element_texts);
$files_added = insert_files_for_item($created, 'Url', array(trim($url->loc)));
What it seems to do in practice is create, for example a second title field with the exact same values as the first one.
thanks,
Dean