function tripal_bulk_loader_delete_template_field_form
2.x tripal_bulk_loader.admin.templates.inc | tripal_bulk_loader_delete_template_field_form($form, &$form_state) |
3.x tripal_bulk_loader.admin.templates.inc | tripal_bulk_loader_delete_template_field_form($form, &$form_state) |
Delete Field Form
This form is meant to be called from a bulk loader form
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_delete_template_field_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 2368 - All functions in this file pertain to administrative management of bulk loader templates
Code
function tripal_bulk_loader_delete_template_field_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;
$field_id = (isset($form_state['build_info']['args'][2])) ? $form_state['build_info']['args'][2] : FALSE;
$form_state['storage']['field_id'] = $field_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;
}
elseif (!$field_id) {
tripal_set_message('Unable to determine the field_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['field_name'] = (isset($_GET['field_name'])) ? $_GET['field_name'] : '';
$_GET['chado_table'] = (isset($_GET['chado_table'])) ? $_GET['chado_table'] : '';
$_GET['chado_field'] = (isset($_GET['chado_field'])) ? $_GET['chado_field'] : '';
$_GET['data_column'] = (isset($_GET['data_column'])) ? $_GET['data_column'] : '';
$_GET['constant_value'] = (isset($_GET['constant_value'])) ? $_GET['constant_value'] : '';
$_GET['foreign_record'] = (isset($_GET['foreign_record'])) ? $_GET['foreign_record'] : '';
$description = '';
$description .= '<table>';
$description .= '<tr><th>Record Name</th><th>Field Name</th><th>Chado Table</th><th>Chado Field</th><th>Data Column</th><th>Constant Value</th><th>Foreign Key</th></tr>';
$description .= '<tr><td>' . $_GET['record_name']
. '</td><td>' . $_GET['field_name']
. '</td><td>' . $_GET['chado_table']
. '</td><td>' . $_GET['chado_field']
. '</td><td>' . $_GET['data_column']
. '</td><td>' . $_GET['constant_value']
. '</td><td>' . $_GET['foreign_record']
. '</td></tr>';
$description .= '</table>';
$description .= '<p><strong>Are you sure you want to delete this field?</strong></p>';
$yes = 'Delete Field';
$no = 'Cancel';
$form['#attributes']['class'][] = 'confirmation';
$form['description'] = array('#markup' => $description);
$form['actions'] = array('#type' => 'actions');
$form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => $yes ? $yes : t('Confirm'),
);
$form['actions']['cancel'] = array(
'#type' => 'link',
'#title' => $no ? $no : t('Cancel'),
'#href' => 'admin/tripal/loaders/bulk/template/' . $template_id . '/edit',
);
// By default, render the form using theme_confirm_form().
if (!isset($form['#theme'])) {
$form['#theme'] = 'confirm_form';
}
return $form;
}