You are here

function content_migrate_select in Content Construction Kit (CCK) 7.3

Form generator for the migration selection form.

@todo Make this into a nice table where you have an option to check all available fields to migrate them all at once.

1 string reference to 'content_migrate_select'
content_migrate_menu in modules/content_migrate/content_migrate.module
Implements hook_menu().

File

modules/content_migrate/includes/content_migrate.admin.inc, line 88
content_migrate.admin.inc Code to process field data migration, moved into a separate file for efficiency.

Code

function content_migrate_select($form, &$form_state) {
  $form = array();
  $options = content_migrate_get_options();
  if (!$options) {
    return $form;
  }
  $header = array(
    t('Field'),
    t('Field type'),
    t('Content type(s)'),
    t('Other information'),
  );
  $form['#tree'] = TRUE;
  $form['available'] = array(
    '#type' => 'fieldset',
    '#collapsible' => TRUE,
    '#collapsed' => count($options['available']) < 1,
    '#title' => t('Available fields'),
    '#description' => t('Fields that have not yet been migrated but are available for migration. <strong>Please carefully read the messages next to each field before migrating it to understand changes that might be made.</strong>'),
  );
  $form['available']['data'] = array(
    '#type' => 'tableselect',
    '#header' => $header,
    '#options' => $options['available'],
    '#empty' => t('No fields are available to be migrated.'),
  );
  $form['available']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Migrate selected fields'),
    '#submit' => array(
      'content_migrate_select_submit',
    ),
  );
  $form['converted'] = array(
    '#type' => 'fieldset',
    '#collapsible' => TRUE,
    '#collapsed' => count($options['converted']) < 1,
    '#title' => t('Converted fields'),
    '#description' => '<p>' . t('Fields that have already been converted. You can choose to roll them back if the conversion did not work correctly. Note that rolling fields back will completely destroy the new field tables.') . ' <span class="error"><strong>' . t('This operation cannot be undone!') . '</strong></span>',
  );
  $form['converted']['data'] = array(
    '#type' => 'tableselect',
    '#header' => $header,
    '#options' => $options['converted'],
    '#empty' => t('No fields are already converted.'),
  );
  $form['converted']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Roll back selected fields'),
    '#submit' => array(
      'content_migrate_rollback_submit',
    ),
  );
  $form['missing'] = array(
    '#type' => 'fieldset',
    '#collapsible' => TRUE,
    '#collapsed' => count($options['missing']) < 1,
    '#title' => t('Unavailable fields'),
    '#description' => t('Fields that cannot be migrated because some modules are missing.'),
  );
  $form['missing']['data'] = array(
    '#type' => 'tableselect',
    '#header' => $header,
    '#options' => $options['missing'],
    '#empty' => t('No fields have missing modules.'),
  );
  return $form;
}