You are here

public function ConfigForm::buildForm in Flysystem 8

Same name and namespace in other branches
  1. 3.x src/Form/ConfigForm.php \Drupal\flysystem\Form\ConfigForm::buildForm()
  2. 2.0.x src/Form/ConfigForm.php \Drupal\flysystem\Form\ConfigForm::buildForm()
  3. 3.0.x src/Form/ConfigForm.php \Drupal\flysystem\Form\ConfigForm::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/ConfigForm.php, line 50

Class

ConfigForm
Configure file system settings for this site.

Namespace

Drupal\flysystem\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $schemes = $this->factory
    ->getSchemes();
  $form['sync_from'] = [
    '#type' => 'select',
    '#options' => array_combine($schemes, $schemes),
    '#title' => $this
      ->t('Sync from'),
    '#required' => TRUE,
  ];
  $form['sync_to'] = [
    '#type' => 'select',
    '#options' => array_combine($schemes, $schemes),
    '#title' => $this
      ->t('Sync to'),
    '#required' => TRUE,
  ];
  $form['force'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Force'),
    '#description' => $this
      ->t('Normally, existing files will be ignored. Selecting this option will overwrite any existing files.'),
  ];
  $form['actions']['#type'] = 'actions';
  $form['actions']['submit'] = [
    '#type' => 'submit',
    '#value' => $this
      ->t('Sync'),
    '#button_type' => 'primary',
  ];
  return $form;
}