mediamosa_browse_collection_form($form, &$form_state, $coll_id = NULL)Add/Edit form
sites/all/modules/mediamosa/maintenance/browse/mediamosa_maintenance_browse_collection.inc, line 409
<?php
function mediamosa_browse_collection_form($form, &$form_state, $coll_id = NULL) {
$collection = NULL;
if (isset($coll_id)) {
$collection = mediamosa_collection::get($coll_id);
if (!$collection) {
$form['collection']['#markup'] = t('Collection was not found.');
}
}
$form['collection'] = array(
'#type' => 'fieldset',
'#title' => t('Collection properties'),
'#collapsible' => TRUE,
);
// You can not move collection to other app, for now.
if (!isset($collection)) {
// Get the apps.
$apps = mediamosa_app::get_all_apps(array(mediamosa_app_db::APP_ID, mediamosa_app_db::APP_NAME), mediamosa_app_db::APP_NAME, 'ASC')->fetchAllKeyed();
$apps = array_merge(array('' => ''), $apps);
$form['collection']['app_id'] = array(
'#type' => 'select',
'#title' => t('Application'),
'#description' => t('Select for which application the collection is made.'),
'#required' => TRUE,
'#options' => $apps,
);
}
else {
$form['coll_id'] = array(
'#type' => 'hidden',
'#value' => $collection[mediamosa_collection_db::ID],
);
}
$form['collection']['owner_id'] = array(
'#type' => 'textfield',
'#title' => t('Owner'),
'#description' => t('The owner of the collection.'),
'#default_value' => isset($collection) ? $collection[mediamosa_collection_db::OWNER_ID] : '',
'#required' => TRUE,
);
$form['collection']['title'] = array(
'#type' => 'textfield',
'#title' => t('Title'),
'#description' => t('The title of the collection.'),
'#default_value' => isset($collection) ? $collection[mediamosa_collection_db::TITLE] : '',
'#required' => TRUE,
);
$form['collection']['description'] = array(
'#type' => 'textarea',
'#title' => t('Description'),
'#description' => t('Short description of the collection.'),
'#default_value' => isset($collection) ? $collection[mediamosa_collection_db::DESCRIPTION] : '',
'#required' => TRUE,
);
if (!isset($collection)) {
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Add collection'),
);
}
else {
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Save collection'),
);
}
return $form;
}
?>