You are here

public function LingotekSettingsTabIntegrationsForm::submitForm in Lingotek Translation 3.4.x

Same name and namespace in other branches
  1. 8.2 src/Form/LingotekSettingsTabIntegrationsForm.php \Drupal\lingotek\Form\LingotekSettingsTabIntegrationsForm::submitForm()
  2. 4.0.x src/Form/LingotekSettingsTabIntegrationsForm.php \Drupal\lingotek\Form\LingotekSettingsTabIntegrationsForm::submitForm()
  3. 3.0.x src/Form/LingotekSettingsTabIntegrationsForm.php \Drupal\lingotek\Form\LingotekSettingsTabIntegrationsForm::submitForm()
  4. 3.1.x src/Form/LingotekSettingsTabIntegrationsForm.php \Drupal\lingotek\Form\LingotekSettingsTabIntegrationsForm::submitForm()
  5. 3.2.x src/Form/LingotekSettingsTabIntegrationsForm.php \Drupal\lingotek\Form\LingotekSettingsTabIntegrationsForm::submitForm()
  6. 3.3.x src/Form/LingotekSettingsTabIntegrationsForm.php \Drupal\lingotek\Form\LingotekSettingsTabIntegrationsForm::submitForm()
  7. 3.5.x src/Form/LingotekSettingsTabIntegrationsForm.php \Drupal\lingotek\Form\LingotekSettingsTabIntegrationsForm::submitForm()
  8. 3.6.x src/Form/LingotekSettingsTabIntegrationsForm.php \Drupal\lingotek\Form\LingotekSettingsTabIntegrationsForm::submitForm()
  9. 3.7.x src/Form/LingotekSettingsTabIntegrationsForm.php \Drupal\lingotek\Form\LingotekSettingsTabIntegrationsForm::submitForm()
  10. 3.8.x src/Form/LingotekSettingsTabIntegrationsForm.php \Drupal\lingotek\Form\LingotekSettingsTabIntegrationsForm::submitForm()

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/LingotekSettingsTabIntegrationsForm.php, line 116

Class

LingotekSettingsTabIntegrationsForm
Configure integration modules settings for Lingotek.

Namespace

Drupal\lingotek\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $needs_rebuild = FALSE;
  $needs_saving = FALSE;
  $config = $this
    ->configFactory()
    ->getEditable('lingotek.settings');
  $form_values = $form_state
    ->getValues();
  if ($this->moduleHandler
    ->moduleExists('paragraphs')) {
    $old_value = $config
      ->get('preference.contrib.paragraphs.enable_bulk_management', FALSE);
    if ($old_value !== $form_values['contrib']['paragraphs']['enable_bulk_management']) {
      $config
        ->set('preference.contrib.paragraphs.enable_bulk_management', boolval($form_values['contrib']['paragraphs']['enable_bulk_management']));
      $needs_saving = TRUE;
      $needs_rebuild = TRUE;
    }
  }
  if ($needs_saving) {
    $config
      ->save();
  }
  if ($needs_rebuild) {
    $this->routerBuilder
      ->rebuild();

    // We need to clear the render cache.
    $this->renderCache
      ->deleteAll();
  }
  $form_state
    ->setRedirect('lingotek.settings');
  parent::submitForm($form, $form_state);
}