function tripal_custom_tables_delete_form

2.x tripal_core.custom_tables.inc tripal_custom_tables_delete_form($form, &$form_state, $table_id)
3.x tripal_chado.custom_tables.inc tripal_custom_tables_delete_form($form, &$form_state, $table_id)

Just a simple form for confirming deletion of a custom table

Related topics

1 string reference to 'tripal_custom_tables_delete_form'
tripal_core_menu in tripal_core/tripal_core.module
Implements hook_menu(). Defines all menu items needed by Tripal Core

File

tripal_core/includes/tripal_core.custom_tables.inc, line 384
Contains functions for creating, editing and deleting custom tables on the Tripal website.

Code

function tripal_custom_tables_delete_form($form, &$form_state, $table_id) {

  // get details about this table entry
  $sql = "SELECT * FROM {tripal_custom_tables} WHERE table_id = :table_id";
  $results = db_query($sql, array(':table_id' => $table_id));
  $entry = $results->fetchObject();

  // if this is a materialized view then don't allow editing with this function
  if ($entry->mview_id) {
    drupal_set_message("This custom table is a materialized view. Please use the " . l('Materialized View', 'admin/tripal/schema/mviews') . " interface to delete it.", 'error');
    drupal_goto("admin/tripal/schema/custom_tables");
    return array();
  }


  $form = array();
  $form['table_id'] = array(
    '#type' => 'value',
    '#value' => $table_id
  );

  $form['sure'] = array(
    '#type' => 'markup',
    '#markup' => '<p>Are you sure you want to delete the "' . $entry->table_name . '" custom table?</p>'
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => 'Delete',
  );
  $form['cancel'] = array(
    '#type' => 'submit',
    '#value' => 'Cancel',
  );
  return $form;
}