You are here

function _migrate_ui_migrate_operations in Migrate 7.2

Return value

array

2 calls to _migrate_ui_migrate_operations()
migrate_ui_migrate_dashboard in migrate_ui/migrate_ui.pages.inc
Form for managing migration groups.
migrate_ui_migrate_group in migrate_ui/migrate_ui.pages.inc
Menu callback

File

migrate_ui/migrate_ui.pages.inc, line 252
Pages for managing migration processes.

Code

function _migrate_ui_migrate_operations() {

  // Build the 'Update options' form.
  $operations = array(
    '#type' => 'fieldset',
    '#title' => t('Operations'),
  );

  //
  switch (variable_get('migrate_import_method', 0)) {
    case 1:
      $options = array(
        'import_background' => t('Import'),
        'rollback_background' => t('Rollback'),
      );
      break;
    case 2:
      $options = array(
        'import_immediate' => t('Import immediately'),
        'import_background' => t('Import in background'),
        'rollback_immediate' => t('Rollback immediately'),
        'rollback_background' => t('Rollback in background'),
      );
      break;
    case 0:
    default:
      $options = array(
        'import_immediate' => t('Import'),
        'rollback_immediate' => t('Rollback'),
      );
      break;
  }
  $options += array(
    'stop' => t('Stop'),
    'reset' => t('Reset'),
    'deregister' => t('Remove migration settings'),
  );
  $operations['operation'] = array(
    '#type' => 'select',
    '#title' => t('Operation'),
    '#title_display' => 'invisible',
    '#options' => $options,
  );
  $operations['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Execute'),
    '#validate' => array(
      'migrate_ui_migrate_validate',
    ),
    '#submit' => array(
      'migrate_ui_migrate_submit',
    ),
  );
  $operations['description'] = array(
    '#prefix' => '<p>',
    '#markup' => t('Choose an operation to run on all selections above:
       <ul>
         <li>Import<br /> Imports all previously unprocessed records from the source, plus
             any records marked for update, into destination Drupal objects.</li>
         <li>Rollback<br /> Deletes all Drupal objects created by the import.</li>
         <li>Stop<br /> Cleanly interrupts any import or rollback processes that may
             currently be running.</li>
         <li>Reset<br /> Sometimes a process may fail to stop cleanly, and be
             left stuck in an Importing or Rolling Back status. Choose Reset to clear
             the status and permit other operations to proceed.</li>
         <li>Remove migration settings<br /> Removes all information about a migration group
             or task, while preserving any content that has already been imported.</li>
       </ul>'),
    '#postfix' => '</p>',
  );
  $operations['options'] = array(
    '#type' => 'fieldset',
    '#title' => t('Options'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#access' => user_access(MIGRATE_ACCESS_ADVANCED),
  );
  $operations['options']['update'] = array(
    '#type' => 'checkbox',
    '#title' => t('Update'),
    '#description' => t('Check this box to update all previously-imported content
      in addition to importing new content. Leave unchecked to only import
      new content'),
  );
  $operations['options']['force'] = array(
    '#type' => 'checkbox',
    '#title' => t('Ignore dependencies'),
    '#description' => t('Check this box to ignore dependencies when running imports
      - all tasks will run whether or not their dependent tasks have
      completed.'),
  );
  $operations['options']['limit'] = array(
    '#tree' => TRUE,
    '#type' => 'fieldset',
    '#attributes' => array(
      'class' => array(
        'container-inline',
      ),
    ),
    'value' => array(
      '#type' => 'textfield',
      '#title' => t('Limit to:'),
      '#size' => 10,
    ),
    'unit' => array(
      '#type' => 'select',
      '#options' => array(
        'items' => t('items'),
        'seconds' => t('seconds'),
      ),
      '#description' => t('Set a limit of how many items to process for
        each migration task, or how long each should run.'),
    ),
  );
  return $operations;
}