You are here

function wordpress_migrate_rollback_confirm in WordPress Migrate 7

1 call to wordpress_migrate_rollback_confirm()
wordpress_migrate_review_form in ./wordpress_migrate.pages.inc
Form for reviewing WordPress migrations.

File

./wordpress_migrate.pages.inc, line 396
Web UI for migrating WordPress blogs to Drupal.

Code

function wordpress_migrate_rollback_confirm($form, &$form_state, $blogs) {
  $operation = $form_state['values']['operation'];
  $form['blogs'] = array(
    '#prefix' => '<ul>',
    '#suffix' => '</ul>',
    '#tree' => TRUE,
  );

  // array_filter returns only elements with TRUE values
  foreach ($blogs as $blog_url) {
    $form['blogs'][$blog_url] = array(
      '#type' => 'hidden',
      '#value' => $blog_url,
      '#prefix' => '<li>',
      '#suffix' => check_plain($blog_url) . "</li>\n",
    );
  }
  $form['operation'] = array(
    '#type' => 'hidden',
    '#value' => $operation,
  );
  $form['#submit'][] = 'wordpress_migrate_rollback_confirm_submit';
  if ($operation == 'rollback') {
    $confirm_question = format_plural(count($blogs), 'Are you sure you want to remove all imported content for this blog?', 'Are you sure you want to remove all imported content for these blogs?');
  }
  else {
    $confirm_question = format_plural(count($blogs), 'Are you sure you want to remove all migration bookkeeping for this blog?', 'Are you sure you want to remove all migration bookkeeping for these blogs?');
  }
  return confirm_form($form, $confirm_question, 'admin/content/wordpress/review', t('This action cannot be undone.'), t('Delete'), t('Cancel'));
}