You are here

protected function LaunchExportForm::addDownloadIframe in Content Synchronizer 8

Same name and namespace in other branches
  1. 8.2 src/Form/LaunchExportForm.php \Drupal\content_synchronizer\Form\LaunchExportForm::addDownloadIframe()
  2. 3.x src/Form/LaunchExportForm.php \Drupal\content_synchronizer\Form\LaunchExportForm::addDownloadIframe()

Add a donwload hidden iframe.

Parameters

array $form: The build form array.

File

src/Form/LaunchExportForm.php, line 157

Class

LaunchExportForm
Launch Export Form.

Namespace

Drupal\content_synchronizer\Form

Code

protected function addDownloadIframe(array &$form) {
  if ($archiveUri = \Drupal::request()
    ->get(EntityExportFormBuilder::ARCHIVE_PARAMS)) {
    if (file_exists($archiveUri)) {
      $form['archive'] = [
        '#type' => 'html_tag',
        '#tag' => 'iframe',
        '#attributes' => [
          'style' => [
            'display:none',
          ],
          'src' => file_create_url($archiveUri),
        ],
      ];
    }
  }
}