Commit a8310573 authored by Dinu Rodnitchi's avatar Dinu Rodnitchi Committed by Damien McKenna
Browse files

Issue #2846650 by paulocs, Grevil, Dinu Rodnitchi, PhilY, aldairsoares,...

Issue #2846650 by paulocs, Grevil, Dinu Rodnitchi, PhilY, aldairsoares, Anybody, ikit-claw, bruno.bicudo, DamienMcKenna: Bring back "Description / note" field to quick save tab.
parent e82bb9e4
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -14,6 +14,9 @@ Backup and Migrate 5.1.x-dev, xxxx-xx-xx
  fixes.
By DamienMcKenna: Updated CHANGELOG.txt for recent 5.0.x changes already present
  in 5.1.x.
#2846650 by paulocs, Grevil, Dinu Rodnitchi, PhilY, aldairsoares, Anybody,
  ikit-claw, bruno.bicudo, DamienMcKenna: Bring back "Description / note" field
  to quick save tab.


Backup and Migrate 5.0.x-dev, xxxx-xx-xx
+9 −1
Original line number Diff line number Diff line
@@ -119,10 +119,18 @@ class BackupController extends ControllerBase {
    $backups = $destination->queryFiles([], $order['sql'], $php_sort, $count);

    foreach ($backups as $backup_id => $backup) {
      $col['description'] = [
        '#markup' => '<div title="' . $backup->getFullName() . '" class="backup-migrate-description">' . $backup->getFullName() . '</div>',
      ];

      if (!empty($backup->getMeta('description'))) {
        $col['description']['#markup'] .= ' <div title="' . $backup->getMeta('description') . '" class="backup-migrate-description">' . $backup->getMeta('description') . '</div>';
      }

      $rows[] = [
        'data' => [
          // Cells.
          $backup->getFullName(),
          \Drupal::service('renderer')->render($col['description']),
          \Drupal::service('date.formatter')
            ->format($backup->getMeta('datestamp')),
          format_size($backup->getMeta('filesize')),
+18 −0
Original line number Diff line number Diff line
@@ -49,6 +49,19 @@ class BackupMigrateQuickBackupForm extends FormBase {
    $form['quickbackup']['destination_id'] = DrupalConfigHelper::getDestinationSelector($bam, $this->t('Backup Destination'));
    $form['quickbackup']['settings_profile_id'] = DrupalConfigHelper::getSettingsProfileSelector($this->t('Settings Profile'));
    unset($form['quickbackup']['destination_id']['#options']['upload']);
    $form['quickbackup']['add_backup_description'] = [
      '#type' => 'checkbox',
      "#title" => $this->t("Add a note to the backup"),
    ];
    $form['quickbackup']['description'] = [
      '#type' => 'textarea',
      "#title" => $this->t("Note"),
      '#states' => [
        'invisible' => [
          ':input[name="add_backup_description"]' => ['checked' => FALSE],
        ],
      ],
    ];
    // @todo Is this needed?
    // Create the service.
    // @code
@@ -79,6 +92,11 @@ class BackupMigrateQuickBackupForm extends FormBase {
      $config = SettingsProfile::load($values['settings_profile_id'])->get('config');
    }

    // Check if user added a backup has a description.
    if ($values['add_backup_description']) {
      $config['metadata']['description'] = $values['description'];
    }

    backup_migrate_perform_backup($values['source_id'], $values['destination_id'], $config);
  }