t('New Collection'), '#description' => t("All content will be migrated from $pid to the selected collection"), '#type' => 'select', '#options' => $potential_collections, ); $form['migrate']['table'] = $table; $form['current'] = array( '#type' => 'hidden', '#value' => $pid, ); $form['migrate']['message'] = array( '#type' => 'item', '#value' => t(""), ); $form['migrate']['submit'] = array( '#type' => 'submit', '#value' => t('Migrate selected objects'), ); return $form; } function islandora_collection_migrate_form_submit($form, &$form_state) { module_load_include('inc', 'islandora', 'RestConnection'); $restConnection = new RestConnection(); $pids = array_filter($form_state['values']['table']); $new_collection = $form_state['values']['new_collection']; $current = $form_state['values']['current']; foreach ($pids as $pid) { $fedora_object = new FedoraObject($pid, $restConnection->repository); $fedora_object->relationships->remove(FEDORA_RELS_EXT_URI, 'isMemberOfCollection', $current); $fedora_object->relationships->add(FEDORA_RELS_EXT_URI, 'isMemberOfCollection', $new_collection); } }