You are here

public function SettingsForm::submitForm in Field Encryption 3.0.x

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/SettingsForm.php, line 161

Class

SettingsForm
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 $field_types) {
    foreach ($field_types as $field_type => $properties) {
      $default_properties[$field_type] = array_keys(array_filter($properties));
    }
  }
  $this
    ->config('field_encrypt.settings')
    ->set('encryption_profile', $form_state
    ->getValue('encryption_profile'))
    ->set('make_entities_uncacheable', $form_state
    ->getValue('make_entities_uncacheable'))
    ->set('default_properties', $default_properties)
    ->set('batch_size', $form_state
    ->getValue('batch_size'))
    ->save();
  parent::submitForm($form, $form_state);
}