You are here

public function BackupDatabaseTablesForm::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/BackupDatabaseTablesForm.php, line 35
Contains \Drupal\backup_db\Form\BackupDatabaseTablesForm.

Class

BackupDatabaseTablesForm
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());

  // @todo, provide reset or none option.
  $form['include_tables'] = array(
    '#type' => 'select',
    '#title' => $this
      ->t('Include tables'),
    '#options' => $options,
    '#multiple' => TRUE,
    '#attributes' => [
      'size' => '8',
    ],
    '#description' => $this
      ->t('Assign tables to include, leave empty for all.'),
    '#default_value' => $config
      ->get('settings.include_tables'),
  );
  $form['exclude_tables'] = array(
    '#type' => 'select',
    '#title' => $this
      ->t('Exclude tables'),
    '#options' => $options,
    '#multiple' => TRUE,
    '#attributes' => [
      'size' => '8',
    ],
    '#description' => $this
      ->t('Assign tables to exclude, leave empty for none.'),
    '#default_value' => $config
      ->get('settings.exclude_tables'),
  );
  return parent::buildForm($form, $form_state);
}