You are here

public function BackupDatabaseCronForm::buildForm in Backup Database 8

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 ConfigFormBase::buildForm

File

src/Form/BackupDatabaseCronForm.php, line 35
Contains \Drupal\backup_db\Form\BackupDatabaseTablesForm.

Class

BackupDatabaseCronForm
BackupDatabaseTablesForm class.

Namespace

Drupal\backup_db\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $config = $this
    ->config('backup_db.settings');
  $options = _backup_db_format_options(backup_db_show_tables());
  $form['cron_backup_enabled'] = array(
    '#title' => t('Enable local database backups on cron runs.'),
    '#type' => 'checkbox',
    '#default_value' => $config
      ->get('cron_backup_enabled'),
  );

  // @todo, provide reset or none option.
  $form['cron_interval'] = array(
    '#title' => t('Backup Interval (hours)'),
    '#type' => 'number',
    '#step' => '1',
    '#description' => 'Number of hours to wait between backups.',
    '#required' => TRUE,
    '#default_value' => $config
      ->get('cron_interval'),
  );
  return parent::buildForm($form, $form_state);
}