You are here

function data_ui_adopt_form in Data 7

Same name and namespace in other branches
  1. 6 data_ui/data_ui.admin.inc \data_ui_adopt_form()

Form callback for adopt table form.

'Orphaned' tables are database tables that don't have an active schema definition.

1 string reference to 'data_ui_adopt_form'
data_ui_menu in data_ui/data_ui.module
Implements hook_menu().

File

data_ui/data_ui.admin.inc, line 249
Admin UI functions.

Code

function data_ui_adopt_form($form, $form_state) {
  $form = array();

  // Compile a list of orphaned tables.
  $drupal_schema = drupal_get_schema(NULL, TRUE);
  $db_schema = schema_dbobject()
    ->inspect();
  $orphaned_tables = array();
  foreach ($db_schema as $name => $table) {
    if (!isset($drupal_schema[$name])) {
      $orphaned_tables[$name] = $name;
    }
  }
  $form['orphaned_tables'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Orphaned Tables'),
    '#options' => $orphaned_tables,
  );
  if (count($orphaned_tables) < 1) {
    $form['no_orphaned_tables'] = array(
      '#type' => 'item',
      '#value' => t('There are no orphaned tables in your database.'),
    );
  }
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => 'Adopt',
  );
  return $form;
}