|
|
@ -42,24 +42,23 @@ function islandora_basic_image_form_islandora_basic_image_node_form_alter(&$form |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
// Add a collection picker if node is new (e.g. this is an insert form). |
|
|
|
// Add a collection picker if node is new (e.g. this is an insert form). |
|
|
|
|
|
|
|
$node = $form_state['node']; |
|
|
|
if (!isset($node->nid) || isset($node->is_new)) { |
|
|
|
if (!isset($node->nid) || isset($node->is_new)) { |
|
|
|
// Construct list of options from db and a default. |
|
|
|
// Construct list of options from db and a default. |
|
|
|
$default = array('' => t('None')); |
|
|
|
|
|
|
|
$from_db = db_select('node', 'n') |
|
|
|
$from_db = db_select('node', 'n') |
|
|
|
->fields('n', array('uuid', 'title')) |
|
|
|
->fields('n', array('uuid', 'title')) |
|
|
|
->condition('n.type', ISLANDORA_COLLECTION_CONTENT_TYPE) |
|
|
|
->condition('n.type', ISLANDORA_COLLECTION_CONTENT_TYPE) |
|
|
|
->execute() |
|
|
|
->execute() |
|
|
|
->fetchAllKeyed(); |
|
|
|
->fetchAllKeyed(); |
|
|
|
$options = $default + $from_db; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Add the select to the form. |
|
|
|
// Add the select to the form. |
|
|
|
$form['parent_collection'] = array( |
|
|
|
$form['parent_collection'] = array( |
|
|
|
'#type' => 'select', |
|
|
|
'#type' => 'select', |
|
|
|
'#title' => t('Parent Collection'), |
|
|
|
'#title' => t('Parent Collection'), |
|
|
|
'#description' => t('Select the parent collection to add this to. Select "Fedora Root" if you want it to be a top-level collection'), |
|
|
|
'#description' => t('Select the parent collection to add this to.'), |
|
|
|
'#options' => $options, |
|
|
|
'#options' => $from_db, |
|
|
|
'#default_value' => '', |
|
|
|
|
|
|
|
'#weight' => -4, |
|
|
|
'#weight' => -4, |
|
|
|
|
|
|
|
'#required' => TRUE, |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
// Keep title on top. |
|
|
|
// Keep title on top. |
|
|
|