function tripal_bulk_loader_duplicate_template_record_form
2.x tripal_bulk_loader.admin.templates.inc | tripal_bulk_loader_duplicate_template_record_form($form, &$form_state) |
3.x tripal_bulk_loader.admin.templates.inc | tripal_bulk_loader_duplicate_template_record_form($form, &$form_state) |
Duplicate Record Form
This form is meant to be called from a bulk loader form
D7 @todo: Needs to be debugged
Parameters
$form_state: Contains the values and storage for the form
Return value
A form array to be rendered by drupal_get_form
Related topics
1 string reference to 'tripal_bulk_loader_duplicate_template_record_form'
- tripal_bulk_loader_menu in tripal_bulk_loader/
tripal_bulk_loader.module - Implements hook_menu().
File
- tripal_bulk_loader/
includes/ tripal_bulk_loader.admin.templates.inc, line 1352 - All functions in this file pertain to administrative management of bulk loader templates
Code
function tripal_bulk_loader_duplicate_template_record_form($form, &$form_state) {
$form['#cache'] = TRUE; // Make sure the form is cached.
// get args from path
$template_id = (isset($form_state['build_info']['args'][0])) ? $form_state['build_info']['args'][0] : FALSE;
$form_state['storage']['template_id'] = $template_id;
$record_id = (isset($form_state['build_info']['args'][1])) ? $form_state['build_info']['args'][1] : FALSE;
$form_state['storage']['record_id'] = $record_id;
// if there is no template supplied don't return rest of form
if (!$template_id) {
tripal_set_message('Unable to determine the template_id from the path.', TRIPAL_ERROR);
return $form;
}
elseif (!$record_id) {
tripal_set_message('Unable to determine the record_id from the path.', TRIPAL_ERROR);
return $form;
}
// set the breadcrumb
$breadcrumb = array();
$breadcrumb[] = l('Home', '<front>');
$breadcrumb[] = l('Administration', 'admin');
$breadcrumb[] = l('Tripal', 'admin/tripal');
$breadcrumb[] = l('Chado Data Loaders', 'admin/tripal/loaders');
$breadcrumb[] = l('Bulk Loader', 'admin/tripal/loaders/bulk');
$breadcrumb[] = l('Templates', 'admin/tripal/loaders/bulk/templates');
$breadcrumb[] = l('Edit Template', 'admin/tripal/loaders/bulk/template/' . $template_id . '/edit');
drupal_set_breadcrumb($breadcrumb);
$_GET['record_name'] = (isset($_GET['record_name'])) ? $_GET['record_name'] : '';
$_GET['chado_table'] = (isset($_GET['chado_table'])) ? $_GET['chado_table'] : '';
$_GET['record_mode'] = (isset($_GET['record_mode'])) ? $_GET['record_mode'] : '';
$description = '';
$description .= '<table>';
$description .= '<caption>Record to be Duplicated</caption>';
$description .= '<tr><th></th><th>Record Name</th><th>Chado Table</th><th>Mode</th></tr>';
$description .= '<tr><td>' . $record_id
. '</td><td>' . $_GET['record_name']
. '</td><td>' . $_GET['chado_table']
. '</td><td>' . $_GET['record_mode']
. '</td></tr>';
$description .= '</table>';
$form['description'] = array(
'#type' => 'markup',
'#markup' => $description,
);
$form['new_record_name'] = array(
'#type' => 'textfield',
'#title' => t('New Record Name'),
'#default_value' => $record_id . '_' . date('YzHi')
);
$form['actions'] = array('#type' => 'actions');
$form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => t('Duplicate Record'),
);
$form['actions']['cancel'] = array(
'#type' => 'link',
'#title' => t('Cancel'),
'#href' => 'admin/tripal/loaders/bulk/template/' . $template_id . '/edit',
);
return $form;
}