You are here

public function UpdateConfigurationForm::buildForm in Config Direct Save 8

Same name and namespace in other branches
  1. 8.2 src/Form/UpdateConfigurationForm.php \Drupal\config_direct_save\Form\UpdateConfigurationForm::buildForm()

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

File

src/Form/UpdateConfigurationForm.php, line 81

Class

UpdateConfigurationForm
Provide the settings form for updating configurations.

Namespace

Drupal\config_direct_save\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $form['config_directory'] = [
    '#type' => 'select',
    '#required' => TRUE,
    '#title' => $this
      ->t('Config source'),
    '#description' => $this
      ->t('Select config source directory'),
    '#options' => array_flip([
      'sync' => Settings::get('config_sync_directory'),
    ]),
  ];
  $form['backup'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Backup'),
    '#description' => $this
      ->t('Check to make a backup for a specific config source(sync for example.)'),
  ];
  $form['update'] = [
    '#type' => 'submit',
    '#value' => $this
      ->t('Update configuration'),
  ];
  return $form;
}