You are here

public function LingotekSettingsTabConfigurationForm::submitForm in Lingotek Translation 8

Same name and namespace in other branches
  1. 8.2 src/Form/LingotekSettingsTabConfigurationForm.php \Drupal\lingotek\Form\LingotekSettingsTabConfigurationForm::submitForm()
  2. 4.0.x src/Form/LingotekSettingsTabConfigurationForm.php \Drupal\lingotek\Form\LingotekSettingsTabConfigurationForm::submitForm()
  3. 3.0.x src/Form/LingotekSettingsTabConfigurationForm.php \Drupal\lingotek\Form\LingotekSettingsTabConfigurationForm::submitForm()
  4. 3.1.x src/Form/LingotekSettingsTabConfigurationForm.php \Drupal\lingotek\Form\LingotekSettingsTabConfigurationForm::submitForm()
  5. 3.2.x src/Form/LingotekSettingsTabConfigurationForm.php \Drupal\lingotek\Form\LingotekSettingsTabConfigurationForm::submitForm()
  6. 3.3.x src/Form/LingotekSettingsTabConfigurationForm.php \Drupal\lingotek\Form\LingotekSettingsTabConfigurationForm::submitForm()
  7. 3.4.x src/Form/LingotekSettingsTabConfigurationForm.php \Drupal\lingotek\Form\LingotekSettingsTabConfigurationForm::submitForm()
  8. 3.5.x src/Form/LingotekSettingsTabConfigurationForm.php \Drupal\lingotek\Form\LingotekSettingsTabConfigurationForm::submitForm()
  9. 3.6.x src/Form/LingotekSettingsTabConfigurationForm.php \Drupal\lingotek\Form\LingotekSettingsTabConfigurationForm::submitForm()
  10. 3.7.x src/Form/LingotekSettingsTabConfigurationForm.php \Drupal\lingotek\Form\LingotekSettingsTabConfigurationForm::submitForm()
  11. 3.8.x src/Form/LingotekSettingsTabConfigurationForm.php \Drupal\lingotek\Form\LingotekSettingsTabConfigurationForm::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/LingotekSettingsTabConfigurationForm.php, line 165
Contains \Drupal\lingotek\Form\LingotekSettingsTabConfigurationForm.

Class

LingotekSettingsTabConfigurationForm
Configure Lingotek

Namespace

Drupal\lingotek\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $values = $form_state
    ->getValue([
    'table',
  ]);
  foreach ($values as $plugin_id => $data) {

    // We only save the enabled status if it changed.
    if ($data['enabled'] && !$this->translationService
      ->isEnabled($plugin_id)) {
      $this->translationService
        ->setEnabled($plugin_id, TRUE);
    }
    if (!$data['enabled'] && $this->translationService
      ->isEnabled($plugin_id)) {
      $this->translationService
        ->setEnabled($plugin_id, FALSE);
    }

    // If we enable it, we save the profile.
    if ($data['enabled'] && $data['profile'] !== $this->lingotekConfig
      ->getConfigEntityDefaultProfileId($plugin_id, FALSE)) {
      $this->lingotekConfig
        ->setConfigEntityDefaultProfileId($plugin_id, $data['profile']);
    }
  }
}