You are here

public function BackupMigrateRestoreForm::buildForm in Backup and Migrate 8.4

Same name and namespace in other branches
  1. 5.0.x src/Form/BackupMigrateRestoreForm.php \Drupal\backup_migrate\Form\BackupMigrateRestoreForm::buildForm()

Form constructor.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

array The form structure.

Overrides FormInterface::buildForm

File

src/Form/BackupMigrateRestoreForm.php, line 24

Class

BackupMigrateRestoreForm
Provides a form for performing a 1-click site backup.

Namespace

Drupal\backup_migrate\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $form = [];
  $bam = backup_migrate_get_service_object();
  $form['backup_migrate_restore_upload'] = [
    '#title' => $this
      ->t('Upload a Backup File'),
    '#type' => 'file',
    '#description' => $this
      ->t("Upload a backup file created by Backup\n      and Migrate. For other database or file backups please use another\n      tool for import. Max file size: %size", [
      "%size" => format_size(file_upload_max_size()),
    ]),
  ];
  $form['source_id'] = DrupalConfigHelper::getPluginSelector($bam
    ->sources(), $this
    ->t('Restore To'));
  $form += DrupalConfigHelper::buildAllPluginsForm($bam
    ->plugins(), 'restore');
  $form['quickbackup']['submit'] = [
    '#type' => 'submit',
    '#value' => $this
      ->t('Restore now'),
    '#weight' => 1,
  ];
  return $form;
}