You are here

public function FieldEncryptSettingsForm::submitForm in Field Encryption 8.2

Form submission handler.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Overrides ConfigFormBase::submitForm

File

src/Form/FieldEncryptSettingsForm.php, line 123

Class

FieldEncryptSettingsForm
Form builder for the field_encrypt settings admin page.

Namespace

Drupal\field_encrypt\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $default_properties = [];
  $form_state
    ->getValue('default_properties');
  $values = $form_state
    ->getValue('default_properties');
  foreach ($values as $category => $field_types) {
    foreach ($field_types as $field_type => $properties) {
      $default_properties[$field_type] = array_keys(array_filter($properties));
    }
  }
  $this
    ->config('field_encrypt.settings')
    ->set('default_properties', $default_properties)
    ->set('batch_size', $form_state
    ->getValue('batch_size'))
    ->save();
  parent::submitForm($form, $form_state);
}