You are here

function invite_migrate_form in Invite 7.4

Migration form.

Return value

array

1 string reference to 'invite_migrate_form'
invite_menu in ./invite.module
Implements hook_menu().

File

includes/invite.admin.inc, line 379

Code

function invite_migrate_form() {
  $form = array();
  $migration_possible = TRUE;

  // Check prerequisites.
  $available_types = array(
    'none' => '- Please select -',
  );
  $invite_types = invite_get_types();
  foreach ($invite_types as $name => $type) {
    if ($type->invite_sending_controller == 'invite_by_email') {
      $available_types[$name] = $type->label;
    }
  }
  if (!module_exists('invite_by_email')) {
    drupal_set_message(t('You should enable Invite by e-mail module.'), 'error');
    $migration_possible = FALSE;
  }
  if (!module_exists('invite_notifications')) {
    drupal_set_message(t('You should enable Invite Notifications module.'), 'error');
    $migration_possible = FALSE;
  }
  if ($migration_possible) {
    $form['type'] = array(
      '#title' => t('Choose type'),
      '#description' => t('Select an Invite type which will be used to import old invites.'),
      '#type' => 'select',
      '#options' => $available_types,
      '#default_value' => 'none',
    );
    $form['drop_old_tables'] = array(
      '#title' => t('Drop old tables'),
      '#description' => t('Drop tables from Invite 2.x module after migration is completed.'),
      '#type' => 'checkbox',
      '#default_value' => TRUE,
    );
    $form['actions'] = array(
      '#type' => 'actions',
    );
    $form['actions']['submit'] = array(
      '#type' => 'submit',
      '#value' => t('Migrate'),
    );
  }
  else {
    $form['message'] = array(
      '#markup' => t('Migration is impossible, please fix errors mentioned above.'),
    );
  }
  return $form;
}