/**
  * Download a backup via the browser.
  *
  * @param \Drupal\backup_migrate\Entity\Destination $backup_migrate_destination
  * @param $backup_id
  */
 public function download(Destination $backup_migrate_destination, $backup_id)
 {
     $destination = $backup_migrate_destination->getObject();
     $file = $destination->getFile($backup_id);
     $file = $destination->loadFileForReading($file);
     $browser = new DrupalBrowserDownloadDestination();
     $browser->saveFile($file);
 }
 /**
  * Form submission handler.
  *
  * @param array $form
  *   An associative array containing the structure of the form.
  * @param \Drupal\Core\Form\FormStateInterface $form_state
  *   The current state of the form.
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     $config = $form_state->getValues();
     backup_migrate_perform_restore($config['source_id'], $this->destination->id(), $this->backup_id, $config);
     $form_state->setRedirectUrl($this->getCancelUrl());
 }
 /**
  * Form submission handler.
  *
  * @param array $form
  *   An associative array containing the structure of the form.
  * @param \Drupal\Core\Form\FormStateInterface $form_state
  *   The current state of the form.
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     $destination = $this->destination->getObject();
     $destination->deleteFile($this->backup_id);
     $form_state->setRedirectUrl($this->getCancelUrl());
 }